forked from unfa/liblast
Networked jumping
parent
54922318ed
commit
8cfcc7c9f2
13
Player.gd
13
Player.gd
|
@ -28,20 +28,23 @@ func walk():
|
||||||
|
|
||||||
#print("Player walkDirection: ", walkDirection)
|
#print("Player walkDirection: ", walkDirection)
|
||||||
|
|
||||||
func jump():
|
remote func jump():
|
||||||
if Input.is_action_just_pressed("MoveJump"):
|
velocity.y = JUMP_VELOCITY
|
||||||
velocity.y = JUMP_VELOCITY
|
|
||||||
|
|
||||||
func motion(delta):
|
func motion(delta):
|
||||||
self.move_and_slide(velocity * delta, Vector3.UP)
|
self.move_and_slide(velocity * delta, Vector3.UP)
|
||||||
#rpc("move_and_slide", velocity, Vector3.UP)
|
#rpc("move_and_slide", velocity, Vector3.UP)
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
gravity()
|
gravity()
|
||||||
walk()
|
walk()
|
||||||
jump()
|
|
||||||
motion(delta)
|
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.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
Loading…
Reference in New Issue