Implement platform and ship movement types; refactor player movement logic and add switching mechanism
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user