Removed floaty platform/area thing

It was no good.
This commit is contained in:
2026-02-20 20:10:42 +11:00
parent 29ff9b1349
commit d656ee8c5e
7 changed files with 1 additions and 125 deletions

View File

@@ -12,45 +12,20 @@ const GRAVITY_FALLING: int = 30
const BOUNCE_FORCE: int = -820 #about 10 tiles
var just_bounced: bool = false #allow max bounce height (i.e. ignore jump input)
#floaty field
const FLOATY_RISING: int = -10
const FLOATY_FALLING: int = -30
const FLOATY_HEIGHT_CLEAR: float = 1_000_000_000
var floaty_height: float = FLOATY_HEIGHT_CLEAR
#limits
const MAX_MOVE_SPEED: int = 300
const MAX_FALL_SPEED: int = 500
const MAX_FLOATY_SPEED: int = -300
#boilerplate
func _ready():
clear_floaty_height()
_sprite.play("idle", 1)
#movement
func _physics_process(_delta) -> void:
#print(position.y, " ", floaty_height)
#jump input
if is_on_floor() and Input.is_action_just_pressed("input_jump"):
velocity.y -= JUMP_FORCE
#vertical movement
elif is_floaty() and position.y >= floaty_height: #below the floaty surface
if is_rising():
velocity.y += FLOATY_RISING
else:
velocity.y += FLOATY_FALLING
elif is_floaty() and position.y < floaty_height: ##above the floaty surface, but still floaty
if is_rising():
velocity.y += GRAVITY_FALLING #rise slower?
else:
var diff = floaty_height - position.y
position.y += log(diff)
velocity.y = 0
#normally, fall faster than you rise
elif is_rising() and (Input.is_action_pressed("input_jump") or just_bounced):
velocity.y += GRAVITY_RISING
@@ -70,8 +45,6 @@ func _physics_process(_delta) -> void:
velocity.x = log(abs(velocity.x)) * sign(velocity.x)
#terminal velocity (in all directions)
if position.y > floaty_height and velocity.y < MAX_FLOATY_SPEED:
velocity.y = MAX_FLOATY_SPEED
if is_falling() and velocity.y > MAX_FALL_SPEED:
velocity.y = MAX_FALL_SPEED
if abs(velocity.x) > MAX_MOVE_SPEED:
@@ -96,11 +69,3 @@ func is_falling() -> bool: return velocity.y >= 0
func apply_bounce() -> void:
velocity.y = BOUNCE_FORCE
just_bounced = true
func set_floaty_height(height: float) -> void:
floaty_height = height
func clear_floaty_height() -> void:
floaty_height = FLOATY_HEIGHT_CLEAR
func is_floaty() -> bool: return floaty_height != FLOATY_HEIGHT_CLEAR