More player movement code

remotes/1711838515240372319/tmp_refs/heads/godot4-port
unfa 2020-06-14 00:38:15 +02:00
parent 7cfa56d974
commit d911a68556
1 changed files with 12 additions and 4 deletions

View File

@ -4,19 +4,27 @@ const GRAVITY = 9.8
var velocity = Vector3.ZERO
var walkDirection = Vector2.ZERO
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
func gravity(delta):
self.velocity.y -= GRAVITY * delta
func gravity():
self.velocity.y -= GRAVITY
func walk():
walkDirection = Vector2.ZERO
#if input
func motion(delta):
self.move_and_slide(velocity, Vector3.UP)
self.move_and_slide(velocity * delta, Vector3.UP)
#rpc("move_and_slide", velocity, Vector3.UP)
func _physics_process(delta):
gravity(delta)
gravity()
walk()
motion(delta)