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,9 +28,8 @@ 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)
@ -39,9 +38,13 @@ func motion(delta):
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.