Tweak Player parameters

master
Fabien Freling 2018-07-19 15:37:10 +02:00
parent a0f3a249ab
commit 331c273302
1 changed files with 7 additions and 5 deletions

View File

@ -1,11 +1,11 @@
extends KinematicBody extends KinematicBody
const norm_gravity = -80 const norm_gravity = -100
var velocity = Vector3() var velocity = Vector3()
const MAX_SLOPE_ANGLE = 60 const MAX_SLOPE_ANGLE = 60
func _ready(): func _ready():
print("player init") pass
func _physics_process(delta): func _physics_process(delta):
# Keyboard input # Keyboard input
@ -23,15 +23,17 @@ func _physics_process(delta):
direction.y = 0 direction.y = 0
direction = direction.normalized() direction = direction.normalized()
# Speep # Speed
var speed = 2.0 var speed = 3.0
direction *= speed direction *= speed
# Gravity # Gravity
direction.y = norm_gravity * delta direction.y = norm_gravity * delta
# Collision # Collision
velocity = move_and_slide(direction, Vector3(0,1,0), 0.05, 4, deg2rad(MAX_SLOPE_ANGLE)) var floor_normal = Vector3(0, 1, 0)
velocity = move_and_slide(direction, floor_normal, 0.05, 4, deg2rad(MAX_SLOPE_ANGLE))
func _process(delta): func _process(delta):
# Called every frame. Delta is time since last frame. # Called every frame. Delta is time since last frame.