SpringBlock.gd 387 B

12345678910111213141516
  1. extends StaticBody2D
  2. @export var is_super := false
  3. func on_player_entered(player: Player) -> void:
  4. player.enemy_bounce_off(false)
  5. play_animation()
  6. AudioManager.play_sfx("spring", global_position)
  7. if is_super:
  8. await get_tree().physics_frame
  9. player.velocity.y *= 1.5
  10. func play_animation() -> void:
  11. $Sprite.play("Bounce")
  12. await $Sprite.animation_finished
  13. $Sprite.play("Idle")