Added player and a basic test level
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
extends NodeState
|
||||
|
||||
@export var player: Player
|
||||
@export var animatedSprite2D: AnimatedSprite2D
|
||||
|
||||
@onready var friction = player.friction
|
||||
|
||||
@warning_ignore("unused_parameter")
|
||||
func on_process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
@warning_ignore("unused_parameter")
|
||||
func on_phyisics_process(delta: float) -> void:
|
||||
|
||||
player.velocity.x = move_toward(player.velocity.x, 0, friction * delta)
|
||||
|
||||
if !animatedSprite2D.is_playing():
|
||||
transition.emit("idle")
|
||||
|
||||
var direction = GameInputEvents.movement_input()
|
||||
|
||||
if direction != 0 and animatedSprite2D.frame > 4:
|
||||
transition.emit("Run")
|
||||
|
||||
if GameInputEvents.jump_input() and animatedSprite2D.frame > 4:
|
||||
transition.emit("Jump")
|
||||
|
||||
func enter() -> void:
|
||||
animatedSprite2D.play("Land")
|
||||
|
||||
func exit() -> void:
|
||||
pass
|
||||
Reference in New Issue
Block a user