Implement platform and ship movement types; refactor player movement logic and add switching mechanism

This commit is contained in:
2025-05-25 04:30:39 +02:00
parent 60779f5b51
commit 33cab8574c
12 changed files with 215 additions and 99 deletions

View File

@@ -25,11 +25,11 @@ func _on_body_entered(body: Node2D) -> void:
if not can_be_launched:
return
if body is PlayerController:
if body is PlayerController and body.current_movement is PlatformMovement:
handle_launchpad_animation()
body.velocity.y = -jump_force
if body.jump_sfx:
body.jump_sfx.play()
if body.current_movement.jump_sfx:
body.current_movement.jump_sfx.play()
func handle_launchpad_animation() -> void:
@@ -39,4 +39,4 @@ func handle_launchpad_animation() -> void:
var timer := get_tree().create_timer(animation_duration)
sprite2d.frame = start_animation_index + 1
await timer.timeout
sprite2d.frame = start_animation_index
sprite2d.frame = start_animation_index