diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-05-04 10:17:24 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-05-04 10:17:24 -0300 |
commit | a76709d24038442880f3174e15e84d5317e61d9f (patch) | |
tree | 77c5f64461daaf44aa7099016c3b4e31e614eaf3 /demos/2d/kinematic_char | |
parent | 9b01f5954afbfa61169a7afd2c3d329e7a2882de (diff) |
-vec3 uniforms should now work, fixes #1773
Diffstat (limited to 'demos/2d/kinematic_char')
-rw-r--r-- | demos/2d/kinematic_char/player.gd | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/demos/2d/kinematic_char/player.gd b/demos/2d/kinematic_char/player.gd index 3549ba3830..ddc0271de0 100644 --- a/demos/2d/kinematic_char/player.gd +++ b/demos/2d/kinematic_char/player.gd @@ -23,6 +23,7 @@ const JUMP_MAX_AIRBORNE_TIME=0.2 const SLIDE_STOP_VELOCITY=1.0 #one pixel per second const SLIDE_STOP_MIN_TRAVEL=1.0 #one pixel + var velocity = Vector2() var on_air_time=100 var jumping=false @@ -94,7 +95,7 @@ func _fixed_process(delta): #Since this formula will always slide the character around, #a special case must be considered to to stop it from moving #if standing on an inclined floor. Conditions are: - # 1) Standin on floor (on_air_time==0) + # 1) Standing on floor (on_air_time==0) # 2) Did not move more than one pixel (get_travel().length() < SLIDE_STOP_MIN_TRAVEL) # 3) Not moving horizontally (abs(velocity.x) < SLIDE_STOP_VELOCITY) # 4) Collider is not moving @@ -117,9 +118,13 @@ func _fixed_process(delta): move(floor_velocity*delta) if (jumping and velocity.y>0): + #if falling, no longer jumping jumping=false if (on_air_time<JUMP_MAX_AIRBORNE_TIME and jump and not prev_jump_pressed and not jumping): + # Jump must also be allowed to happen if the + # character left the floor a little bit ago. + # Makes controls more snappy. velocity.y=-JUMP_SPEED jumping=true |