did some tinkering with the hud
This commit is contained in:
@@ -72,8 +72,9 @@ func _process(delta: float) -> void:
|
||||
|
||||
if player != null:
|
||||
# Crosshair
|
||||
var velocity_adjust = clamp(player.velocity.length() * .1,1,3)
|
||||
crosshair_target = lerp(crosshair_target,CROSSHAIR_SIZE,delta * 5)
|
||||
crosshair.size = lerp(crosshair.size, crosshair_target,delta * 20)
|
||||
crosshair.size = lerp(crosshair.size, crosshair_target * velocity_adjust,delta * 20)
|
||||
crosshair.position = Vector2(viewportWidth/2,viewportHeight/2) + (crosshair.size/-2)
|
||||
crosshair_center.position = Vector2(viewportWidth/2,viewportHeight/2) + (crosshair_center.scale * crosshair_center.size/-2)
|
||||
stamina_bar.scale = (crosshair.size/CROSSHAIR_SIZE) * Vector2(.185,.185)
|
||||
@@ -218,5 +219,4 @@ func spawn_notifs():
|
||||
can_spawn = true
|
||||
|
||||
func player_hit():
|
||||
pass
|
||||
#self.position += wiggle_element(25)
|
||||
crosshair_size_change()
|
||||
|
||||
@@ -491,6 +491,7 @@ func _physics_process(delta):
|
||||
joypad_look()
|
||||
aim_down_sights(delta)
|
||||
flashlight_toggle()
|
||||
hud_wobble(delta)
|
||||
hold_item(delta)
|
||||
move_and_slide()
|
||||
crouch(delta)
|
||||
@@ -622,11 +623,19 @@ func grab_moveable(body):
|
||||
held_item.gravity_scale = 0
|
||||
held_item.set_collision_layer_value(1,false)
|
||||
|
||||
func hud_wobble(delta):
|
||||
const HUD_WOBBLE_MAX : float = 10
|
||||
const MOUSE_AMT = 0
|
||||
const VELOCITY_AMT = 10
|
||||
var dir = Vector2(-velocity.x * VELOCITY_AMT - mouse_input.x * MOUSE_AMT,velocity.y * VELOCITY_AMT - mouse_input.y * MOUSE_AMT)
|
||||
var dir_clamped = clamp(dir,Vector2(-HUD_WOBBLE_MAX,-HUD_WOBBLE_MAX),Vector2(HUD_WOBBLE_MAX,HUD_WOBBLE_MAX))
|
||||
hud.position = lerp(hud.position, dir_clamped, delta * 5)
|
||||
|
||||
func hold_item(_delta):
|
||||
# Move Held Items
|
||||
if held_item != null:
|
||||
interact_ray.look_at(held_item.global_position, Vector3.UP)
|
||||
var held_dir = (moveable_holder.global_position - held_item.global_position) #+ hold_offset
|
||||
var held_dir = (moveable_holder.global_position - held_item.global_position)
|
||||
held_item.linear_velocity = held_dir * 50
|
||||
held_item.rotation = Vector3(0,held_item_rotation,0) + Vector3(0,camera.global_rotation.y,0)
|
||||
#break when moved too far away
|
||||
|
||||
Reference in New Issue
Block a user