Jump to content


Photo

Platform Codes!


  • Please log in to reply
8 replies to this topic

#1 gamemaker7pro

gamemaker7pro

    GMC Member

  • New Member
  • 252 posts

Posted 03 January 2009 - 06:53 PM

[Here are some platform codes of mine:

Moving (in step event) by the way, "dot" is the sprite in the code.
{
if keyboard_check(vk_left) && !keyboard_check(vk_right)
{
 sprite_index = dot// what the sprite looks like moving left
 x-=15; // speed if obj. when moving left
}
else
if keyboard_check(vk_right) && !keyboard_check(vk_left)
{
 sprite_index = dot // what the sprite looks like moving right
 x+=15; // speed of obj. when it moves right
}
else
if keyboard_check_released(vk_left)
{
 sprite_index = dot // sprite that shows when left is released
}
else
if keyboard_check_released(vk_right)
{
sprite_index = dot // sprite that is show when user releases right
}
}

Jumping ( Look at commented out section, it has double single and triple)
Note: this code has double jump activated, and single/triple jump commented out.
Create event:

//single
//jump=1
//gravity_direction=270

//double
jump=2
gravity_direction=270;

//triple
//jump=3
//gravity_direction=270

In step event:
//double
if keyboard_check_pressed(vk_up) && !keyboard_check_pressed(vk_down)
{
if jump>0
{
vspeed=-10
jump-=1
}
}
if place_free(x,y+.5)
{
gravity=0.5
}
else
{
gravity=0
}
/*

//single:
if keyboard_check_pressed(vk_up) && !keyboard_check_pressed(vk_down)
{
if jump>0
{
vspeed=-10
jump-=1
}
}

if place_free(x,y+.5)
{
gravity=0.5
}
else
{
gravity=0
}
*/
/*
//Triple:
if keyboard_check_pressed(vk_up) && !keyboard_check_pressed(vk_down)
{
if jump>0
{
vspeed=-10
jump-=1
}
}
if place_free(x,y+.5)
{
gravity=0.5
}
else
{
gravity=0
}
*/



In collision with the floor:


//single
//jump=1
//gravity_direction=270

//double
jump=2
gravity_direction=270;

//triple
//jump=3
//gravity_direction=270

hope it helped
Julian

Edited by gamemaker7pro, 03 January 2009 - 06:55 PM.

  • 0

#2 gamemaker7pro

gamemaker7pro

    GMC Member

  • New Member
  • 252 posts

Posted 04 January 2009 - 01:14 AM

No comments still? :medieval:
  • 0

#3 Jax

Jax

    GMC Member

  • New Member
  • 232 posts

Posted 04 January 2009 - 07:14 PM

Hmm, it seems that you can't move left or right when in a collision with the floor. You must jump first...
-Rock on! :)

~Jax
  • 0

#4 gamemaker7pro

gamemaker7pro

    GMC Member

  • New Member
  • 252 posts

Posted 11 January 2009 - 05:43 AM

well that is not all you need to put to move on the floor lol, you need all the gravity and vspeed and movetocontact code
  • 0

#5 rochowmaster

rochowmaster

    GMC Member

  • New Member
  • 59 posts

Posted 30 January 2011 - 08:16 AM

OOOOOOOOOOOOOOOOOOOOOOOOOOOSSSSSSSSSSSSSSSSSSSSSSSIIIIIIIIIIIIIIIIIIIIIMMMMMMMMMMMM!!!!!

I LOVE IT!!!

really well explained, and different options in comment form was a good idea! XD

Well done Julian!!!
  • 0

#6 _191253

_191253

    GMC Member

  • New Member
  • 9 posts

Posted 08 July 2011 - 03:04 AM

um im still a little lost about the cant move comment
  • 1

#7 waluigiman

waluigiman

    GMC Member

  • New Member
  • 20 posts

Posted 06 February 2012 - 12:04 PM

I need some help here, I used the codes, and like everyone else said, I can't move when my character is touching the floor... Can somebody help me with this? it's driving me insane...
  • 0

#8 _253410

_253410

    GMC Member

  • New Member
  • 18 posts
  • Version:Unknown

Posted 14 February 2012 - 11:16 PM

I need some help here, I used the codes, and like everyone else said, I can't move when my character is touching the floor... Can somebody help me with this? it's driving me insane...



If you don't want to double or triple jump: Insert
&& !position_empty(object.x,object.y)
after the keyboard check for up or space or whatever you are using
  • 0

#9 keikider

keikider

    GMC Member

  • New Member
  • 7 posts
  • Version:GM8.1

Posted 28 April 2013 - 08:21 PM

i need help with this

 

how do i change jump height????


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users