diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-07-19 14:18:21 +0200 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-07-19 14:18:21 +0200 |
commit | 7ce3593119b399196d71c88e3d1cab08ff38bb80 (patch) | |
tree | cb0abec447ee9d053836b3eefb9a3947f4a2cb6c /Characters/Character.gd | |
parent | 7e579ced0b51f98b2c14a0c868bf428c12d4790b (diff) |
Diffstat (limited to 'Characters/Character.gd')
-rw-r--r-- | Characters/Character.gd | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/Characters/Character.gd b/Characters/Character.gd index c9eaa0a..f8c3a59 100644 --- a/Characters/Character.gd +++ b/Characters/Character.gd @@ -18,7 +18,7 @@ var lastWallDirection = Enum.DIRECTION.LEFT func _ready(): - pass + set_up_direction(Vector2.UP) func _physics_process(delta): @@ -34,8 +34,6 @@ func _physics_process(delta): $Sprite2D.flip_h = false if self.is_running(): velocity.x = RUNSPEED - - set_up_direction(Vector2.UP) if is_on_floor(): if Input.is_action_pressed("DIRECTION_LEFT") or Input.is_action_pressed("DIRECTION_RIGHT"): @@ -112,6 +110,18 @@ func _physics_process(delta): move_and_slide() + self.updatePuppet() + + +func is_running(): + return Input.is_action_pressed("RUN") and is_on_floor() + + +func canWallJump(): + return (is_on_wall() and not is_on_floor()) or not $WalljumpTimer.is_stopped() + + +func updatePuppet(): if Network.player.position != self.position: Network.player.position = self.position Network.update_player() @@ -123,14 +133,6 @@ func _physics_process(delta): Network.update_player() -func is_running(): - return Input.is_action_pressed("RUN") and is_on_floor() - - -func canWallJump(): - return (is_on_wall() and not is_on_floor()) or not $WalljumpTimer.is_stopped() - - func check_flag(): # $Sprite.play("dance anim") print("FLAG CHECKED") |