camera, textures, game scaling, tilemap

This commit is contained in:
OddlyTimbot committed 2026-05-11 21:04:27 -04:00
1 parent a200dd1a51
commit b40dad2de0
15 files changed
+587 -7

No files matched your search

+23 -1
View File
@@ -11,12 +11,14 @@ 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 pushTarget:RigidBody2D
var pushEnabled:bool = false
var upJump:bool = false
func _physics_process(delta: float) -> void:
handle_input()
handle_movement(delta)
@@ -43,6 +45,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.
@@ -95,6 +99,13 @@ 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:
@@ -102,4 +113,15 @@ func handle_animation()->void:
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