Jumping - Platformer
This code will let you jump in a platformer. It is a simple code having 1 part in step event and the other in the jump button event
The step code is
[code]
if position_empty(x,y+1)
gravity=0.5
gravity_direction=270
if !position_empty(x,y+1)
then
gravity=0
gravity_direction=270
if vspeed>12
then
vspeed=12
[/code]
And for the up it is
[code]
if collision_point(x,y+1,solid,true,false)
then vspeed=-10
[/code]
This code has been tested!
The step code is
[code]
if position_empty(x,y+1)
gravity=0.5
gravity_direction=270
if !position_empty(x,y+1)
then
gravity=0
gravity_direction=270
if vspeed>12
then
vspeed=12
[/code]
And for the up it is
[code]
if collision_point(x,y+1,solid,true,false)
then vspeed=-10
[/code]
This code has been tested!
Labels: Novice

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home