more hud work
This commit is contained in:
@@ -5,6 +5,9 @@ extends StaticBody3D
|
||||
@export var ammo_amount = 20
|
||||
@onready var jump_sound = $JumpSound
|
||||
|
||||
var can_jump = false
|
||||
var player
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
@@ -12,14 +15,17 @@ func _ready():
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
if can_jump:
|
||||
if Input.is_action_just_pressed("jump"):
|
||||
player.velocity.y = jump_amount
|
||||
jump_sound.play()
|
||||
|
||||
|
||||
func _on_area_3d_body_entered(body):
|
||||
if body.is_in_group("player"):
|
||||
body.velocity.y = jump_amount
|
||||
jump_sound.play()
|
||||
if body.ammo < body.gun.max_ammo + ammo_amount:
|
||||
body.ammo += ammo_amount
|
||||
if stamina_replenish == true:
|
||||
body.remaining_stamina = body.MAX_STAMINA
|
||||
can_jump = true
|
||||
player = body
|
||||
|
||||
func _on_area_3d_body_exited(body: Node3D) -> void:
|
||||
if body.is_in_group("player"):
|
||||
can_jump = false
|
||||
|
||||
@@ -147,7 +147,7 @@ func _process(delta: float) -> void:
|
||||
fade_in_out(current_stam_bar,STAM_BAR_MAX_OPACITY,stam_bar_visible,5,delta)
|
||||
|
||||
func crosshair_size_change():
|
||||
crosshair_target += Vector2(40,40)
|
||||
crosshair_target += Vector2(20,20)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ extends Control
|
||||
@onready var level_control = get_tree().current_scene
|
||||
@onready var player: CharacterBody3D = $"../../../.."
|
||||
|
||||
var paused
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
visible = false
|
||||
@@ -26,16 +28,20 @@ func _on_load_pressed() -> void:
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if Input.is_action_just_pressed("escape"):
|
||||
pause()
|
||||
if paused:
|
||||
resume()
|
||||
else:
|
||||
pause()
|
||||
|
||||
func pause():
|
||||
paused = true
|
||||
get_tree().paused = true
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
player.toggle_hud(false)
|
||||
player.pause_menu.show()
|
||||
|
||||
|
||||
func resume():
|
||||
paused = false
|
||||
hide()
|
||||
get_tree().paused = false
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
|
||||
@@ -492,12 +492,14 @@ func crouch(delta):
|
||||
|
||||
func aim_down_sights(delta):
|
||||
if gun:
|
||||
if gun.ads == true:
|
||||
if ads:
|
||||
if ads:
|
||||
if gun.ads == true:
|
||||
camera.fov = lerp(camera.fov,BASE_FOV - float(gun.fov_zoom_amt),(delta * 5)/Engine.time_scale)
|
||||
gun.position = lerp(gun.position,ADS_POS,delta * 10 / Engine.time_scale)
|
||||
else:
|
||||
gun.position = lerp(gun.position, weapon_start_pos,delta * 2)
|
||||
camera.fov = lerp(camera.fov,BASE_FOV - float(gun.fov_zoom_amt),(delta * 5)/Engine.time_scale)
|
||||
|
||||
|
||||
func _headbob(time) -> Vector3:
|
||||
var pos = Vector3.ZERO
|
||||
|
||||
@@ -56,6 +56,8 @@ func explode():
|
||||
if body.is_in_group("player"):
|
||||
body.velocity += clamp(blast_velocity,Vector3(-7,-7,-7),Vector3(7,7,7))
|
||||
body.recoil.add_recoil(Vector3(1,.1,.1),10,10)
|
||||
if body.has_method("hit") and !body.is_in_group("player"):
|
||||
body.hit(1)
|
||||
if body.is_in_group("enemy"):
|
||||
body.knocked = true
|
||||
body.stunned = true
|
||||
|
||||
@@ -47,6 +47,9 @@ func _on_body_entered(body: Node) -> void:
|
||||
if body.is_in_group("switch"):
|
||||
body.hit(bullet_damage)
|
||||
|
||||
if body.has_method("hit") and !body.is_in_group("player"):
|
||||
body.hit(1)
|
||||
|
||||
if body.is_in_group("breakable"):
|
||||
var current_velocity = transform.basis * Vector3(0,0,-1 * bullet_force_mod)
|
||||
body.breaking(current_velocity)
|
||||
|
||||
@@ -133,7 +133,7 @@ func _on_area_3d_body_part_hit(dam,bullet_damage):
|
||||
func _on_prefire_timer_timeout():
|
||||
fire(barrel_1)
|
||||
smoke.emitting = true
|
||||
#await get_tree().create_timer(.5).timeout # makes it too hard lol
|
||||
await get_tree().create_timer(.01).timeout # makes it too hard lol
|
||||
fire(barrel_2)
|
||||
smoke_2.emitting = true
|
||||
turret_material.emission_enabled = false
|
||||
|
||||
Reference in New Issue
Block a user