forked from unfa/liblast
More player movement code
parent
7cfa56d974
commit
d911a68556
16
Player.gd
16
Player.gd
|
@ -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)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue