fixed hud, moved weapon and ammo penalties to gamemode
This commit is contained in:
@@ -42,6 +42,8 @@ const CROSSHAIR_SIZE = Vector2(40,40)
|
||||
var pickup_notifs = []
|
||||
var can_spawn = true
|
||||
|
||||
var dir_clamped = Vector2.ZERO
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
# Get Viewport size
|
||||
@@ -227,16 +229,21 @@ func player_hit():
|
||||
func hud_wobble(delta):
|
||||
var viewport_height_adj = (get_viewport().size.y/1080)
|
||||
|
||||
var HUD_WOBBLE_MAX : float = 40 * viewport_height_adj
|
||||
var MOUSE_AMT = 10 * viewport_height_adj
|
||||
var HUD_WOBBLE_MAX : float = 4 * viewport_height_adj
|
||||
var MOUSE_AMT = 1 * viewport_height_adj
|
||||
var VELOCITY_AMT = 100 * viewport_height_adj
|
||||
var HUD_SPEED = 10 * viewport_height_adj
|
||||
var HUD_MOVE_SPEED = 1 * viewport_height_adj
|
||||
var HUD_RETURN_SPEED = 10 * viewport_height_adj
|
||||
|
||||
var dir_mouse = Vector2(-player.mouse_input.x * MOUSE_AMT,-player.mouse_input.y * MOUSE_AMT)
|
||||
var velocity_dir_transformed = player.velocity.normalized() * player.global_basis
|
||||
var velocity_lengh_clamped = clamp(player.velocity.length(),-VELOCITY_AMT,VELOCITY_AMT)
|
||||
var dir_velocity = Vector2(-velocity_dir_transformed.x * velocity_lengh_clamped,velocity_dir_transformed.y * velocity_lengh_clamped)
|
||||
var dir_clamped = clamp(dir_mouse + dir_velocity,Vector2(-HUD_WOBBLE_MAX,-HUD_WOBBLE_MAX),Vector2(HUD_WOBBLE_MAX,HUD_WOBBLE_MAX))
|
||||
var offset = lerp(position, dir_clamped, delta * HUD_SPEED)
|
||||
|
||||
return offset
|
||||
#add movement
|
||||
dir_clamped += clamp(dir_mouse + dir_velocity,Vector2(-HUD_WOBBLE_MAX,-HUD_WOBBLE_MAX),Vector2(HUD_WOBBLE_MAX,HUD_WOBBLE_MAX))
|
||||
#return to zero over time
|
||||
dir_clamped = lerp(dir_clamped,Vector2.ZERO,delta * HUD_RETURN_SPEED)
|
||||
#apply offset
|
||||
|
||||
return dir_clamped
|
||||
|
||||
Reference in New Issue
Block a user