Networked jumping

godot4-port
Jan 2020-06-14 01:05:03 +02:00
parent 54922318ed
commit 8cfcc7c9f2
1 changed files with 8 additions and 5 deletions

View File

@ -28,20 +28,23 @@ func walk():
#print("Player walkDirection: ", walkDirection)
func jump():
if Input.is_action_just_pressed("MoveJump"):
velocity.y = JUMP_VELOCITY
remote func jump():
velocity.y = JUMP_VELOCITY
func motion(delta):
self.move_and_slide(velocity * delta, Vector3.UP)
#rpc("move_and_slide", velocity, Vector3.UP)
func _physics_process(delta):
gravity()
walk()
jump()
motion(delta)
func _input(event):
if event.is_action_pressed("MoveJump"):
#rpc("jump")
jump()
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.