mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 15:38:14 +00:00
25 lines
656 B
GDScript
25 lines
656 B
GDScript
extends PlayerState
|
|
|
|
const ENTER_SPEED := 50
|
|
|
|
func enter(_msg := {}) -> void:
|
|
player.can_hurt = false
|
|
player.velocity = Vector2.ZERO
|
|
player.z_index = -5
|
|
physics_update(0)
|
|
|
|
func physics_update(delta: float) -> void:
|
|
player.global_position += (ENTER_SPEED * (player.pipe_enter_direction * player.pipe_move_direction)) * delta
|
|
if player.pipe_enter_direction.x != 0:
|
|
player.sprite.speed_scale = 1
|
|
player.play_animation("PipeWalk")
|
|
player.direction = int(player.pipe_enter_direction.x)
|
|
player.sprite.scale.x = player.direction
|
|
else:
|
|
player.play_animation("Pipe")
|
|
|
|
func exit() -> void:
|
|
player.can_hurt = true
|
|
player.z_index = 1
|
|
player.show()
|