diff options
Diffstat (limited to 'Characters')
-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") |