testing Jordan's suggestions
This commit is contained in:
@@ -6,7 +6,7 @@ const MOVE_FORCE: int = 300 #about 10 tiles horizontally (airborne arc)
|
|||||||
const JUMP_FORCE: int = 500 #about 4 tiles vertically
|
const JUMP_FORCE: int = 500 #about 4 tiles vertically
|
||||||
|
|
||||||
const GRAVITY_RISING: int = 15
|
const GRAVITY_RISING: int = 15
|
||||||
const GRAVITY_FALLING: int = 30
|
const GRAVITY_FALLING: int = 60
|
||||||
|
|
||||||
#bouncy platform
|
#bouncy platform
|
||||||
const BOUNCE_FORCE: int = -820 #about 10 tiles vertically
|
const BOUNCE_FORCE: int = -820 #about 10 tiles vertically
|
||||||
@@ -43,12 +43,21 @@ func _physics_process(_delta) -> void:
|
|||||||
velocity.y = -JUMP_FORCE
|
velocity.y = -JUMP_FORCE
|
||||||
buffer_grounded = 0
|
buffer_grounded = 0
|
||||||
buffer_jumping = 0
|
buffer_jumping = 0
|
||||||
|
#normally, fall faster than you rise + smooth apex at peak
|
||||||
#normally, fall faster than you rise
|
if not is_on_floor():
|
||||||
elif velocity.y < 0 and (Input.is_action_pressed("input_jump") or just_bounced):
|
var grav = GRAVITY_FALLING
|
||||||
velocity.y += GRAVITY_RISING
|
if velocity.y < 0 and (Input.is_action_pressed("input_jump") or just_bounced):
|
||||||
|
grav = GRAVITY_RISING
|
||||||
|
else:
|
||||||
|
grav = GRAVITY_FALLING
|
||||||
|
just_bounced = false # reset here so bounce ascent uses light gravity
|
||||||
|
|
||||||
|
# smooth the transition right at the top
|
||||||
|
if abs(velocity.y) < 80:
|
||||||
|
grav = int(grav * 0.65)
|
||||||
|
|
||||||
|
velocity.y += grav
|
||||||
else:
|
else:
|
||||||
velocity.y += GRAVITY_FALLING
|
|
||||||
just_bounced = false
|
just_bounced = false
|
||||||
|
|
||||||
#sideways movement
|
#sideways movement
|
||||||
|
|||||||
Reference in New Issue
Block a user