made bullet with a camera on the end. other tweaks
This commit is contained in:
@@ -12,6 +12,7 @@ var distance_from_player
|
||||
var player_position
|
||||
var player_velocity
|
||||
var bullet_active = true
|
||||
var bullet_target : Node
|
||||
|
||||
@onready var mesh = $Cylinder
|
||||
@onready var particles = $GPUParticles3D
|
||||
@@ -23,47 +24,85 @@ var bullet_active = true
|
||||
func _ready():
|
||||
|
||||
visible = false
|
||||
linear_velocity += transform.basis * Vector3(0, 0, -bullet_speed) + player_velocity
|
||||
if bullet_target == null:
|
||||
linear_velocity += transform.basis * Vector3(0, 0, -bullet_speed) + player_velocity
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _physics_process(delta):
|
||||
|
||||
angular_velocity = Vector3(0,0,0)
|
||||
|
||||
distance_from_player = abs(self.global_position - player_position)
|
||||
distance_from_player = self.global_position.distance_to(player_position)
|
||||
|
||||
if distance_from_player.length() > 1.5:
|
||||
if distance_from_player > 1.5:
|
||||
visible = true
|
||||
|
||||
|
||||
if bullet_target != null:
|
||||
linear_velocity = transform.basis * Vector3(0, 0, -bullet_speed)
|
||||
look_at(bullet_target.global_position)
|
||||
|
||||
if ray.is_colliding():
|
||||
var body = ray.get_collider()
|
||||
if body != null and !body.is_in_group("player"):
|
||||
|
||||
mesh.visible = false
|
||||
ray.enabled = false
|
||||
|
||||
if body.is_in_group("enemy_target"):
|
||||
hit_indicator.play()
|
||||
enemy_particles.emitting = true
|
||||
SignalBus.emit_signal("enemy_hit")
|
||||
ray.get_collider().hit(bullet_damage)
|
||||
|
||||
#bullethole effect
|
||||
body.add_child(instance_bullethole)
|
||||
instance_bullethole.global_transform.origin = ray.get_collision_point()
|
||||
if (abs(ray.get_collision_normal().y) > 0.99):
|
||||
instance_bullethole.look_at(ray.get_collision_point() + ray.get_collision_normal(), Vector3(0,0,1))
|
||||
else:
|
||||
instance_bullethole.look_at(ray.get_collision_point() + ray.get_collision_normal())
|
||||
|
||||
if body.is_in_group("switch"):
|
||||
body.hit()
|
||||
|
||||
#move rigidbodies
|
||||
if body.is_in_group("scene_rigidbody"):
|
||||
body.linear_velocity += transform.basis * Vector3(0,0,-1 * bullet_force_mod)
|
||||
|
||||
if body.is_in_group("breakable"):
|
||||
var current_velocity = transform.basis * Vector3(0,0,-1 * bullet_force_mod)
|
||||
ray.get_collider().breaking(current_velocity)
|
||||
|
||||
despawn()
|
||||
|
||||
func _on_body_entered(body: Node) -> void:
|
||||
|
||||
if !body.is_in_group("player"):
|
||||
|
||||
ray.enabled = false
|
||||
|
||||
if ray.is_colliding():
|
||||
var ray_body = ray.get_collider()
|
||||
if ray_body != null:
|
||||
#bullethole effect
|
||||
ray_body.add_child(instance_bullethole)
|
||||
instance_bullethole.global_transform.origin = ray.get_collision_point()
|
||||
if (abs(ray.get_collision_normal().y) > 0.99):
|
||||
instance_bullethole.look_at(ray.get_collision_point() + ray.get_collision_normal(), Vector3(0,0,1))
|
||||
else:
|
||||
instance_bullethole.look_at(ray.get_collision_point() + ray.get_collision_normal())
|
||||
|
||||
if body.is_in_group("switch"):
|
||||
body.hit()
|
||||
|
||||
##move rigidbodies
|
||||
#if body.is_in_group("scene_rigidbody"):
|
||||
#body.linear_velocity += transform.basis * Vector3(0,0,-1 * bullet_force_mod)
|
||||
|
||||
if body.is_in_group("breakable"):
|
||||
var current_velocity = transform.basis * Vector3(0,0,-1 * bullet_force_mod)
|
||||
body.breaking(current_velocity)
|
||||
despawn()
|
||||
#func _on_body_entered(body: Node) -> void:
|
||||
#
|
||||
#if !body.is_in_group("player"):
|
||||
#
|
||||
#ray.enabled = false
|
||||
#
|
||||
#if ray.is_colliding():
|
||||
#var ray_body = ray.get_collider()
|
||||
#if ray_body != null:
|
||||
##bullethole effect
|
||||
#ray_body.add_child(instance_bullethole)
|
||||
#instance_bullethole.global_transform.origin = ray.get_collision_point()
|
||||
#if (abs(ray.get_collision_normal().y) > 0.99):
|
||||
#instance_bullethole.look_at(ray.get_collision_point() + ray.get_collision_normal(), Vector3(0,0,1))
|
||||
#else:
|
||||
#instance_bullethole.look_at(ray.get_collision_point() + ray.get_collision_normal())
|
||||
#
|
||||
#if body.is_in_group("switch"):
|
||||
#body.hit()
|
||||
#
|
||||
###move rigidbodies
|
||||
##if body.is_in_group("scene_rigidbody"):
|
||||
##body.linear_velocity += transform.basis * Vector3(0,0,-1 * bullet_force_mod)
|
||||
#
|
||||
#if body.is_in_group("breakable"):
|
||||
#var current_velocity = transform.basis * Vector3(0,0,-1 * bullet_force_mod)
|
||||
#body.breaking(current_velocity)
|
||||
#despawn()
|
||||
|
||||
func despawn():
|
||||
#visible = false
|
||||
|
||||
106
scripts/bullet_cam.gd
Normal file
106
scripts/bullet_cam.gd
Normal file
@@ -0,0 +1,106 @@
|
||||
extends RigidBody3D
|
||||
|
||||
@export var collision_shape : Node
|
||||
|
||||
var bullet_speed
|
||||
var bullet_drop
|
||||
var random_spread_amt
|
||||
var bullet_damage
|
||||
var instance_bullethole
|
||||
var bullet_force_mod = 1.0
|
||||
var distance_from_player
|
||||
var player_position
|
||||
var player_velocity
|
||||
var bullet_active = true
|
||||
var bullet_target : Node
|
||||
var hold_cam_pos = null
|
||||
var camera_start
|
||||
var distance_to_cam_start
|
||||
var player_cam_FOV : float
|
||||
var opaque_color = Color(0.702, 0.557, 0.224)
|
||||
var transparent_color = Color(0.702, 0.557, 0.224, 0)
|
||||
|
||||
@onready var level_control = get_tree().current_scene
|
||||
@onready var player = level_control.player
|
||||
@onready var mesh = $Cylinder
|
||||
@onready var particles = $GPUParticles3D
|
||||
@onready var enemy_particles = $GPUParticlesEnemy
|
||||
@onready var hit_indicator = $Audio/HitIndicator
|
||||
@onready var ray: RayCast3D = $RayCast3D
|
||||
@onready var camera: Camera3D = $Camera3D
|
||||
@onready var camera_handle: Node3D = $CameraHandle
|
||||
@onready var bullet_material = mesh.get_surface_override_material(0)
|
||||
|
||||
const BULLET_CAM_FOV : float = 130
|
||||
const BULLET_SENSITIVITY : float = 1
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventMouseMotion and hold_cam_pos == null:
|
||||
var av_y = -event.relative.x * BULLET_SENSITIVITY
|
||||
var av_x = -event.relative.y * BULLET_SENSITIVITY
|
||||
angular_velocity += transform.basis * Vector3(av_x,av_y,0)
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
Engine.time_scale = .01
|
||||
player.gamespeed_controlled = true
|
||||
player.controlled_elsewhere = true
|
||||
player_cam_FOV = player.camera.fov
|
||||
camera.fov = player_cam_FOV
|
||||
camera_start = player.camera.global_position
|
||||
camera.global_position = camera_start
|
||||
distance_to_cam_start = camera.global_position.distance_to(camera_handle.global_position)
|
||||
camera.current = true
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _physics_process(delta):
|
||||
camera.fov = lerp(player_cam_FOV,BULLET_CAM_FOV, delta * 3000)
|
||||
linear_velocity = transform.basis * Vector3(0, 0, -bullet_speed)
|
||||
|
||||
var distance_to_cam = camera.global_position.distance_to(camera_handle.global_position) / (distance_to_cam_start*2)
|
||||
bullet_material.albedo_color = lerp(transparent_color,opaque_color,distance_to_cam)
|
||||
|
||||
if hold_cam_pos != null:
|
||||
camera.global_position = hold_cam_pos
|
||||
else:
|
||||
camera.global_position = lerp(camera.global_position,camera_handle.global_position, delta * 300)
|
||||
|
||||
if ray.is_colliding() and hold_cam_pos == null:
|
||||
hold_cam_pos = camera.global_position
|
||||
Engine.time_scale = .005
|
||||
|
||||
|
||||
func _on_body_entered(body: Node) -> void:
|
||||
|
||||
if !body.is_in_group("player"):
|
||||
|
||||
ray.enabled = false
|
||||
|
||||
if ray.is_colliding():
|
||||
var ray_body = ray.get_collider()
|
||||
if ray_body != null:
|
||||
#bullethole effect
|
||||
ray_body.add_child(instance_bullethole)
|
||||
instance_bullethole.global_transform.origin = ray.get_collision_point()
|
||||
if (abs(ray.get_collision_normal().y) > 0.99):
|
||||
instance_bullethole.look_at(ray.get_collision_point() + ray.get_collision_normal(), Vector3(0,0,1))
|
||||
else:
|
||||
instance_bullethole.look_at(ray.get_collision_point() + ray.get_collision_normal())
|
||||
|
||||
if body.is_in_group("switch"):
|
||||
body.hit()
|
||||
|
||||
|
||||
if body.is_in_group("breakable"):
|
||||
var current_velocity = transform.basis * Vector3(0,0,-1 * bullet_force_mod)
|
||||
body.breaking(current_velocity)
|
||||
despawn()
|
||||
|
||||
func despawn():
|
||||
player.camera.current = true
|
||||
player.controlled_elsewhere = false
|
||||
player.gamespeed_controlled = false
|
||||
#visible = false
|
||||
#collision_shape.disabled = true
|
||||
#await get_tree().create_timer(1).timeout
|
||||
queue_free()
|
||||
@@ -22,7 +22,7 @@ var bullet_target : Node
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
|
||||
linear_velocity += player_velocity
|
||||
visible = false
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
@@ -37,8 +37,7 @@ func _physics_process(delta):
|
||||
|
||||
if distance_from_player.length() > 1.5:
|
||||
visible = true
|
||||
|
||||
|
||||
|
||||
func _on_body_entered(body: Node) -> void:
|
||||
|
||||
if !body.is_in_group("player"):
|
||||
@@ -10,7 +10,7 @@ const SPRINT_SPEED = 15.0
|
||||
const DASH_SPEED = 40
|
||||
const SLOWSPEED = .1
|
||||
const MAX_STAMINA : float = 100
|
||||
const STAMINA_DRAIN = 200
|
||||
const STAMINA_DRAIN = 100 #multiplied times the delta when draining
|
||||
|
||||
var speed
|
||||
var double_jump = true
|
||||
@@ -75,6 +75,7 @@ var held_item_angular_damp_cache
|
||||
var held_item_gravity_cache
|
||||
var held_item_mass_cache
|
||||
var held_item_rotation = Vector3(0,0,0)
|
||||
var gamespeed_controlled = false
|
||||
|
||||
# Slow Down Variables
|
||||
var remaining_stamina : float = MAX_STAMINA
|
||||
@@ -84,6 +85,7 @@ var picked_up_text
|
||||
var pickup_announce = load("res://assets/pickup_announce.tscn")
|
||||
var dead_announce = load("res://assets/dead_announce.tscn")
|
||||
var pickupmsg
|
||||
var controlled_elsewhere = false
|
||||
|
||||
@onready var crosshair = $Head/Recoil/Camera3D/Crosshair
|
||||
@onready var head = $Head
|
||||
@@ -110,11 +112,13 @@ var pickupmsg
|
||||
@onready var stand_check: RayCast3D = $StandCheck
|
||||
@onready var r_hand_test: MeshInstance3D = $Head/Recoil/Camera3D/WeaponHolder/RHandTest
|
||||
@onready var l_hand_test: MeshInstance3D = $Head/Recoil/Camera3D/WeaponHolder/LHandTest
|
||||
@onready var enemy_killed_audio: AudioStreamPlayer = $Audio/EnemyKilled
|
||||
|
||||
|
||||
func _ready():
|
||||
|
||||
SignalBus.enemy_hit.connect(enemy_hit)
|
||||
SignalBus.enemy_killed.connect(enemy_killed)
|
||||
|
||||
weapon_holder_start_rot = weapon_holder.rotation
|
||||
weapon_holder_start_pos = weapon_holder.position
|
||||
@@ -134,20 +138,20 @@ func _ready():
|
||||
AudioServer.set_bus_volume_db(0,-80)
|
||||
|
||||
func _input(event) -> void:
|
||||
|
||||
if !level_control.paused:
|
||||
if event is InputEventMouseMotion:
|
||||
self.rotate_y(-event.relative.x * SENSITIVITY)
|
||||
head.rotate_x(-event.relative.y * SENSITIVITY)
|
||||
head.rotation.x = clamp(head.rotation.x, deg_to_rad(-90), deg_to_rad(85))
|
||||
mouse_input = event.relative
|
||||
else:
|
||||
if event is InputEventMouseMotion:
|
||||
self.rotate_y(event.relative.x * .00001)
|
||||
head.rotate_x(event.relative.y * .00001)
|
||||
head.rotation.x = clamp(head.rotation.x, deg_to_rad(-90), deg_to_rad(85))
|
||||
mouse_input = event.relative
|
||||
|
||||
if !controlled_elsewhere:
|
||||
if !level_control.paused:
|
||||
if event is InputEventMouseMotion:
|
||||
self.rotate_y(-event.relative.x * SENSITIVITY)
|
||||
head.rotate_x(-event.relative.y * SENSITIVITY)
|
||||
head.rotation.x = clamp(head.rotation.x, deg_to_rad(-90), deg_to_rad(85))
|
||||
mouse_input = event.relative
|
||||
else:
|
||||
if event is InputEventMouseMotion:
|
||||
self.rotate_y(event.relative.x * .00001)
|
||||
head.rotate_x(event.relative.y * .00001)
|
||||
head.rotation.x = clamp(head.rotation.x, deg_to_rad(-90), deg_to_rad(85))
|
||||
mouse_input = event.relative
|
||||
|
||||
func _physics_process(delta):
|
||||
|
||||
if !dead and !level_control.paused:
|
||||
@@ -219,13 +223,10 @@ func _physics_process(delta):
|
||||
health_indicator.color = lerp(Color(0.471, 0, 0, 0), Color(0.471, 0, 0, .25),health_opacity)
|
||||
|
||||
# Moving Fast Sound
|
||||
#initiate fast movement -- may be done with this block
|
||||
#change sounds with speed
|
||||
var wind_volume = clamp(velocity.length()/20,0,1) #expected max velocity for effect
|
||||
ear_wind.volume_db = lerp(-80,0,wind_volume)
|
||||
|
||||
if moving_fast:
|
||||
var wind_volume = clamp( velocity.length() - 20 ,-80,10)
|
||||
ear_wind.volume_db = wind_volume
|
||||
#reset at apex
|
||||
|
||||
#cache fastest speed
|
||||
if abs(velocity.y) > moving_fast_top_speed:
|
||||
moving_fast_top_speed = abs(velocity.y)
|
||||
@@ -243,23 +244,25 @@ func _physics_process(delta):
|
||||
# Game Speed
|
||||
if !level_control.paused:
|
||||
if Input.is_action_pressed("slow_down") and remaining_stamina > 0 :
|
||||
Engine.time_scale = lerp(Engine.time_scale, SLOWSPEED, delta * 20)
|
||||
gun.random_spread_amt = 0
|
||||
AudioServer.set_bus_effect_enabled(0,0,true)
|
||||
camera.fov = lerp(camera.fov, camera.fov * gun.fov_zoom_amt, delta * 100)
|
||||
if sensitivity_shift == true:
|
||||
SENSITIVITY = lerp(SENSITIVITY, SENSITIVITY * .998, delta * 100)
|
||||
if remaining_stamina > 0:
|
||||
remaining_stamina = clamp(remaining_stamina - (delta * STAMINA_DRAIN),0,MAX_STAMINA)
|
||||
if !gamespeed_controlled:
|
||||
Engine.time_scale = lerp(Engine.time_scale, SLOWSPEED, delta * 20)
|
||||
gun.random_spread_amt = 0
|
||||
AudioServer.set_bus_effect_enabled(0,0,true)
|
||||
camera.fov = lerp(camera.fov, camera.fov * gun.fov_zoom_amt, delta * 100)
|
||||
if sensitivity_shift == true:
|
||||
SENSITIVITY = lerp(SENSITIVITY, SENSITIVITY * .998, delta * 100)
|
||||
if remaining_stamina > 0:
|
||||
remaining_stamina = clamp(remaining_stamina - (delta * STAMINA_DRAIN),0,MAX_STAMINA)
|
||||
else:
|
||||
Engine.time_scale = lerp(Engine.time_scale, 1.0, delta * 50)
|
||||
gun.random_spread_amt = gun.random_spread_start
|
||||
AudioServer.set_bus_effect_enabled(0,0,false)
|
||||
if sensitivity_shift == true:
|
||||
camera.fov = lerp(camera.fov, BASE_FOV, delta * .5)
|
||||
SENSITIVITY = start_sensitivity
|
||||
if remaining_stamina < MAX_STAMINA and !Input.is_action_pressed("slow_down"):
|
||||
remaining_stamina = clamp(remaining_stamina + (delta * STAMINA_DRAIN/10), 0, MAX_STAMINA)
|
||||
if !gamespeed_controlled:
|
||||
Engine.time_scale = lerp(Engine.time_scale, 1.0, delta * 50)
|
||||
gun.random_spread_amt = gun.random_spread_start
|
||||
AudioServer.set_bus_effect_enabled(0,0,false)
|
||||
if sensitivity_shift == true:
|
||||
camera.fov = lerp(camera.fov, BASE_FOV, delta * .5)
|
||||
SENSITIVITY = start_sensitivity
|
||||
if remaining_stamina < MAX_STAMINA and !Input.is_action_pressed("slow_down"):
|
||||
remaining_stamina = clamp(remaining_stamina + (delta * STAMINA_DRAIN/10), 0, MAX_STAMINA)
|
||||
|
||||
|
||||
# Reloading
|
||||
@@ -354,6 +357,7 @@ func _physics_process(delta):
|
||||
weapon_sway(delta)
|
||||
weapon_bob(velocity.length(), delta)
|
||||
|
||||
|
||||
func _headbob(time) -> Vector3:
|
||||
var pos = Vector3.ZERO
|
||||
pos.y = sin(time * BOB_FREQ) * BOB_AMP
|
||||
@@ -414,6 +418,9 @@ func enemy_hit():
|
||||
camera.add_child(hitmarker_spawn)
|
||||
hit_indicator.play()
|
||||
|
||||
func enemy_killed():
|
||||
enemy_killed_audio.play()
|
||||
|
||||
func toggle_hud(hud_on):
|
||||
|
||||
if dead:
|
||||
@@ -426,7 +433,7 @@ func toggle_hud(hud_on):
|
||||
func grab_moveable(body):
|
||||
moveable_holder.global_position = body.global_position
|
||||
held_item = body
|
||||
held_item_rotation = body.rotation
|
||||
held_item_rotation = Vector3(0,0,0)#body.rotation
|
||||
#cache rigidbody settings
|
||||
held_item_linear_damp_cache = body.linear_damp
|
||||
held_item_angular_damp_cache = body.angular_damp
|
||||
@@ -443,8 +450,9 @@ func hold_item():
|
||||
if held_item != null:
|
||||
var held_dir = moveable_holder.global_position - held_item.global_position
|
||||
var held_av = held_item_rotation - held_item.rotation
|
||||
held_item.linear_velocity = held_dir * 30
|
||||
held_item.angular_velocity = held_av * 10
|
||||
held_item.linear_velocity = held_dir * 5
|
||||
held_item.look_at(camera.global_position)
|
||||
#held_item.angular_velocity = held_av * 10
|
||||
|
||||
#break when moved too far away
|
||||
var distance_from_player = abs(self.global_position - held_item.global_position)
|
||||
|
||||
@@ -20,10 +20,11 @@ var rot_amount : float
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
SignalBus.enemy_killed.connect(enemy_in_room_killed)
|
||||
|
||||
for i in self.get_children():
|
||||
if i.is_in_group("enemy"):
|
||||
enemies.append(i)
|
||||
i.last_enemy_dead.connect(last_enemy_dead)
|
||||
if i.is_in_group("door"):
|
||||
doors.append(i)
|
||||
if i.is_in_group("room_check"):
|
||||
@@ -66,13 +67,19 @@ func _process(delta):
|
||||
i.loot_amount = 20 #assign loot to the last enemy drop from this section
|
||||
i.last_enemy = true
|
||||
|
||||
func last_enemy_dead():
|
||||
if room_lockdown:
|
||||
room_lockdown = false
|
||||
func enemy_in_room_killed():
|
||||
var enemy_count = 0
|
||||
for i in self.get_children():
|
||||
if i.is_in_group("enemy") and i.health > 0:
|
||||
enemy_count += 1
|
||||
|
||||
for i in doors:
|
||||
if !i.door_open:
|
||||
i.open()
|
||||
if enemy_count <= 0:
|
||||
if room_lockdown:
|
||||
room_lockdown = false
|
||||
|
||||
for i in doors:
|
||||
if !i.door_open:
|
||||
i.open()
|
||||
|
||||
func room_entered():
|
||||
if room_lockdown:
|
||||
|
||||
@@ -12,6 +12,7 @@ var player_position
|
||||
var bounces = 0
|
||||
var start_time
|
||||
var end_time
|
||||
var start_velocity
|
||||
|
||||
const EMISSION_MAX : float = 200
|
||||
const EMISSION_LIFETIME : float = 1.75 #in seconds
|
||||
@@ -22,7 +23,8 @@ func _ready() -> void:
|
||||
visible = false
|
||||
start_time = Time.get_ticks_msec()
|
||||
end_time = start_time + (EMISSION_LIFETIME * 1000)
|
||||
|
||||
start_velocity = linear_velocity.length()
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
var current_time = (Time.get_ticks_msec())/end_time
|
||||
@@ -30,6 +32,7 @@ func _process(delta: float) -> void:
|
||||
|
||||
var distance_from_player = abs(self.global_position - player_position)
|
||||
|
||||
|
||||
if distance_from_player.length() > 1.5:
|
||||
visible = true
|
||||
|
||||
|
||||
@@ -3,3 +3,4 @@ extends Node
|
||||
signal switch_changed()
|
||||
signal switch_timeout()
|
||||
signal enemy_hit()
|
||||
signal enemy_killed()
|
||||
|
||||
@@ -185,10 +185,7 @@ func die():
|
||||
get_tree().get_root().add_child(particlespawn)
|
||||
|
||||
drop_loot(loot_amount)
|
||||
|
||||
if last_enemy:
|
||||
emit_signal("last_enemy_dead")
|
||||
|
||||
SignalBus.emit_signal("enemy_killed")
|
||||
queue_free()
|
||||
|
||||
func drop_loot(number_of_drops):
|
||||
|
||||
@@ -20,7 +20,6 @@ extends Node3D
|
||||
@export_subgroup("Main Assets")
|
||||
@export var tracker_indicator : Node
|
||||
@export var flare_light : Node
|
||||
@export var bullet : Resource
|
||||
@export var bullet_fake : Resource
|
||||
@export var bullethole : Resource
|
||||
@export var casing : Resource
|
||||
@@ -39,6 +38,7 @@ extends Node3D
|
||||
@onready var level_control = get_tree().current_scene
|
||||
@onready var ammo_current
|
||||
@onready var tracker_marker = load("res://assets/tracker_marker.tscn")
|
||||
@onready var bullet : Resource = load("res://assets/bullet.tscn")
|
||||
@onready var tracker_indicator_material = tracker_indicator.get_surface_override_material(0)
|
||||
|
||||
var tracker : Node
|
||||
@@ -160,6 +160,11 @@ func remove_tracker():
|
||||
tracker.remove()
|
||||
tracker = null
|
||||
|
||||
func check_ammo():
|
||||
if level_control.ammo_current[gun_index] == 0 and level_control.ammo_reserve[gun_index] > 0:
|
||||
anim_player.play("reload")
|
||||
audio_reload.play()
|
||||
|
||||
func reload():
|
||||
if tracker != null:
|
||||
anim_player.play("remove_tracker")
|
||||
|
||||
Reference in New Issue
Block a user