camera, textures, scaling, tile map

This commit is contained in:
torontocaper committed 2026-05-11 21:03:27 -04:00
1 parent 5ffaba9ce9
commit f7c4c4b3ca
17 files changed
+627 -9

No files matched your search

+25 -3
View File
@@ -10,9 +10,9 @@ const JUMP_VELOCITY = -400.0
var direction
enum FaceDirection{LEFT,RIGHT}
var facing:FaceDirection = FaceDirection.RIGHT
enum PlayerState{IDLE,RUNNING}
enum PlayerState{IDLE,RUNNING,JUMPING,FALLING}
var current_player_state:PlayerState = PlayerState.IDLE
var upjump:bool = false
func _physics_process(delta: float) -> void:
@@ -48,6 +48,8 @@ func handle_input()->void:
if Input.is_action_just_pressed("jump") and is_on_floor():
velocity.y = JUMP_VELOCITY
upjump = true
current_player_state = PlayerState.JUMPING
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
@@ -66,10 +68,30 @@ func handle_state()->void:
current_player_state = PlayerState.RUNNING
PlayerState.RUNNING when velocity.x ==0:
current_player_state = PlayerState.IDLE
PlayerState.JUMPING when velocity.y > 0:
current_player_state = PlayerState.FALLING
PlayerState.FALLING when is_on_floor():
if velocity.x ==0:
current_player_state = PlayerState.IDLE
else:
current_player_state=PlayerState.RUNNING
func handle_animation()->void:
match current_player_state:
PlayerState.IDLE:
player_graphic.play("idle")
PlayerState.RUNNING:
player_graphic.play("run")
PlayerState.JUMPING:
if upjump:
player_graphic.play("jump")
PlayerState.FALLING:
player_graphic.play("fall")
func _on_animation_finished() -> void:
match current_player_state:
PlayerState.JUMPING:
upjump = false