From 7ce3593119b399196d71c88e3d1cab08ff38bb80 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Fri, 19 Jul 2024 14:18:21 +0200 Subject: cleanup and begin lobby rework --- Characters/Character.gd | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'Characters') 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") -- cgit v1.2.3