Trim whitespaces
This commit is contained in:
parent
ffad2cee34
commit
ad5b96576a
1 changed files with 16 additions and 16 deletions
|
@ -22,7 +22,7 @@ func _ready():
|
||||||
camera = $Character/Camera_rotation_helper/Camera
|
camera = $Character/Camera_rotation_helper/Camera
|
||||||
camera.make_current()
|
camera.make_current()
|
||||||
flashlight = $Character/MeshInstance/Flashlight
|
flashlight = $Character/MeshInstance/Flashlight
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
process_input(delta)
|
process_input(delta)
|
||||||
process_movement(delta)
|
process_movement(delta)
|
||||||
|
@ -34,10 +34,10 @@ func process_input(delta):
|
||||||
# Walking
|
# Walking
|
||||||
dir = Vector3()
|
dir = Vector3()
|
||||||
var cam_xform = camera.get_global_transform()
|
var cam_xform = camera.get_global_transform()
|
||||||
|
|
||||||
var input_movement_vector = Vector3()
|
var input_movement_vector = Vector3()
|
||||||
var cam_scroll = 0.0
|
var cam_scroll = 0.0
|
||||||
|
|
||||||
if Input.is_action_pressed("move_up"):
|
if Input.is_action_pressed("move_up"):
|
||||||
input_movement_vector.z += 1
|
input_movement_vector.z += 1
|
||||||
if Input.is_action_pressed("move_down"):
|
if Input.is_action_pressed("move_down"):
|
||||||
|
@ -46,12 +46,12 @@ func process_input(delta):
|
||||||
input_movement_vector.x -= 1
|
input_movement_vector.x -= 1
|
||||||
if Input.is_action_pressed("move_right"):
|
if Input.is_action_pressed("move_right"):
|
||||||
input_movement_vector.x += 1
|
input_movement_vector.x += 1
|
||||||
|
|
||||||
input_movement_vector = input_movement_vector.normalized()
|
input_movement_vector = input_movement_vector.normalized()
|
||||||
|
|
||||||
dir += -cam_xform.basis.z.normalized() * input_movement_vector.z
|
dir += -cam_xform.basis.z.normalized() * input_movement_vector.z
|
||||||
dir += cam_xform.basis.x.normalized() * input_movement_vector.x
|
dir += cam_xform.basis.x.normalized() * input_movement_vector.x
|
||||||
|
|
||||||
if Input.is_action_pressed("fly_up"):
|
if Input.is_action_pressed("fly_up"):
|
||||||
vel.y = FLY_SPEED
|
vel.y = FLY_SPEED
|
||||||
elif Input.is_action_pressed("fly_down"):
|
elif Input.is_action_pressed("fly_down"):
|
||||||
|
@ -60,27 +60,27 @@ func process_input(delta):
|
||||||
vel.y = 0
|
vel.y = 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func process_movement(delta):
|
func process_movement(delta):
|
||||||
|
|
||||||
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
|
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
|
||||||
dir.y = 0
|
dir.y = 0
|
||||||
dir = dir.normalized()
|
dir = dir.normalized()
|
||||||
|
|
||||||
# vel.y += delta*GRAVITY
|
# vel.y += delta*GRAVITY
|
||||||
|
|
||||||
var hvel = vel
|
var hvel = vel
|
||||||
hvel.y = 0
|
hvel.y = 0
|
||||||
|
|
||||||
var target = dir
|
var target = dir
|
||||||
target *= MAX_SPEED
|
target *= MAX_SPEED
|
||||||
|
|
||||||
var accel
|
var accel
|
||||||
if dir.dot(hvel) > 0:
|
if dir.dot(hvel) > 0:
|
||||||
accel = ACCEL
|
accel = ACCEL
|
||||||
else:
|
else:
|
||||||
accel = DEACCEL
|
accel = DEACCEL
|
||||||
|
|
||||||
hvel = hvel.linear_interpolate(target, accel*delta)
|
hvel = hvel.linear_interpolate(target, accel*delta)
|
||||||
vel.x = hvel.x
|
vel.x = hvel.x
|
||||||
vel.z = hvel.z
|
vel.z = hvel.z
|
||||||
|
@ -99,8 +99,8 @@ func process_movement(delta):
|
||||||
$Character.get_node( "../../GUI/HUD/Jauges/trauma/ProgressBar" ).value += 0.25
|
$Character.get_node( "../../GUI/HUD/Jauges/trauma/ProgressBar" ).value += 0.25
|
||||||
if $Character.get_node( "../../GUI/HUD/Jauges/trauma/ProgressBar" ).value >= 100:
|
if $Character.get_node( "../../GUI/HUD/Jauges/trauma/ProgressBar" ).value >= 100:
|
||||||
$Character.get_node( "../../GUI/HUD/Jauges/oubli/ProgressBar" ).value += 0.25
|
$Character.get_node( "../../GUI/HUD/Jauges/oubli/ProgressBar" ).value += 0.25
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
|
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
|
||||||
|
@ -130,7 +130,7 @@ func _input(event):
|
||||||
camera.translation.x = old_x_translation
|
camera.translation.x = old_x_translation
|
||||||
camera.translation.y = old_y_translation
|
camera.translation.y = old_y_translation
|
||||||
camera.translation.z = clamp(camera.translation.z, 0, 5)
|
camera.translation.z = clamp(camera.translation.z, 0, 5)
|
||||||
|
|
||||||
# TODO trouver pourquoi cela ne se fait plus:
|
# TODO trouver pourquoi cela ne se fait plus:
|
||||||
if Input.is_action_just_pressed("game_flashlight"):
|
if Input.is_action_just_pressed("game_flashlight"):
|
||||||
# flashlight.visible = not flashlight.visible
|
# flashlight.visible = not flashlight.visible
|
||||||
|
|
Loading…
Reference in a new issue