Upload files to 'entities/player'
This commit is contained in:
parent
1abc4ef824
commit
1a0f2a100b
|
@ -26,3 +26,37 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0 )
|
||||||
keep_aspect = 0
|
keep_aspect = 0
|
||||||
fov = 80.0
|
fov = 80.0
|
||||||
far = 250.0
|
far = 250.0
|
||||||
|
|
||||||
|
[node name="Node2D" type="Node2D" parent="."]
|
||||||
|
|
||||||
|
[node name="HSlider" type="HSlider" parent="Node2D"]
|
||||||
|
margin_left = 108.021
|
||||||
|
margin_top = 10.4773
|
||||||
|
margin_right = 460.021
|
||||||
|
margin_bottom = 43.4773
|
||||||
|
min_value = 15.0
|
||||||
|
max_value = 150.0
|
||||||
|
value = 97.0
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Node2D"]
|
||||||
|
margin_left = 70.7272
|
||||||
|
margin_top = 20.9431
|
||||||
|
margin_right = 125.727
|
||||||
|
margin_bottom = 43.9431
|
||||||
|
text = "FOV:"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="fps_num" type="Label" parent="Node2D"]
|
||||||
|
margin_left = 466.032
|
||||||
|
margin_top = 20.0198
|
||||||
|
margin_right = 535.032
|
||||||
|
margin_bottom = 59.0198
|
||||||
|
text = "placehold"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ extends KinematicBody
|
||||||
export(float) var mouse_sensitivity = 12.0
|
export(float) var mouse_sensitivity = 12.0
|
||||||
export(NodePath) var head_path
|
export(NodePath) var head_path
|
||||||
export(NodePath) var cam_path
|
export(NodePath) var cam_path
|
||||||
export(float) var FOV = 80.0
|
export(float) var FOV = 120.0
|
||||||
var mouse_axis := Vector2()
|
var mouse_axis := Vector2()
|
||||||
onready var head: Spatial = get_node(head_path)
|
onready var head: Spatial = get_node(head_path)
|
||||||
onready var cam: Camera = get_node(cam_path)
|
onready var cam: Camera = get_node(cam_path)
|
||||||
|
@ -44,6 +44,8 @@ func _process(_delta: float) -> void:
|
||||||
move_axis.y = Input.get_action_strength("move_right") - Input.get_action_strength("move_left")
|
move_axis.y = Input.get_action_strength("move_right") - Input.get_action_strength("move_left")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Called every physics tick. 'delta' is constant
|
# Called every physics tick. 'delta' is constant
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
if flying:
|
if flying:
|
||||||
|
@ -81,6 +83,7 @@ func walk(delta: float) -> void:
|
||||||
if Input.is_action_just_pressed("move_jump"):
|
if Input.is_action_just_pressed("move_jump"):
|
||||||
_snap = Vector3.ZERO
|
_snap = Vector3.ZERO
|
||||||
velocity.y = jump_height
|
velocity.y = jump_height
|
||||||
|
print("[DEBUG] Jumped")
|
||||||
|
|
||||||
# Apply Gravity
|
# Apply Gravity
|
||||||
velocity.y -= gravity * delta
|
velocity.y -= gravity * delta
|
||||||
|
@ -91,9 +94,15 @@ func walk(delta: float) -> void:
|
||||||
_speed = sprint_speed
|
_speed = sprint_speed
|
||||||
cam.set_fov(lerp(cam.fov, FOV * 1.05, delta * 8))
|
cam.set_fov(lerp(cam.fov, FOV * 1.05, delta * 8))
|
||||||
sprinting = true
|
sprinting = true
|
||||||
|
# print("[DEBUG] Sprint is on") # Generally, this causes debug console spam, so you may wanna turn it off
|
||||||
|
var fovslide = $Node2D/HSlider.value
|
||||||
|
$Head/Camera.fov = fovslide
|
||||||
|
$Node2D/fps_num.text = str(fovslide)
|
||||||
else:
|
else:
|
||||||
|
var fovslide = $Node2D/HSlider.value
|
||||||
|
$Node2D/fps_num.text = str(fovslide)
|
||||||
_speed = walk_speed
|
_speed = walk_speed
|
||||||
cam.set_fov(lerp(cam.fov, FOV, delta * 8))
|
cam.set_fov(lerp(cam.fov, fovslide, delta * 8))
|
||||||
sprinting = false
|
sprinting = false
|
||||||
|
|
||||||
# Acceleration and Deacceleration
|
# Acceleration and Deacceleration
|
||||||
|
|
Reference in New Issue