123456789101112131415161718192021222324252627282930313233343536 |
- class_name Jumper
- extends RigidBody2D
- const SPEED = 5.0
- const JUMP_IMPULSE = 942.5
- const MOVE_FORCE = 1142
- @export var player := 1 :
- set(id):
- player = id
-
- $JumperInput.set_multiplayer_authority(id)
- @onready var input: JumperInput = $JumperInput
- func _ready():
- pass
- func _physics_process(delta):
-
- if input.jumping:
- apply_impulse(Vector2.UP * JUMP_IMPULSE)
-
- input.jumping = false
-
- var direction = input.direction
- direction.y = 0
- if direction:
- apply_force(direction * MOVE_FORCE)
|