mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 15:38:14 +00:00
added the game
This commit is contained in:
24
Scripts/Classes/States/Player/Pipe.gd
Normal file
24
Scripts/Classes/States/Player/Pipe.gd
Normal file
@@ -0,0 +1,24 @@
|
||||
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()
|
Reference in New Issue
Block a user