Added Health pickup, started pickup assignment through level control and added enemy counter
This commit is contained in:
@@ -17,6 +17,7 @@ const MAX_AV = 10
|
||||
@export var bullet_damage = 1
|
||||
@export var turret_look_speed = 6
|
||||
|
||||
@onready var level_control = get_tree().current_scene
|
||||
@onready var nav_agent = $NavigationAgent3D
|
||||
@onready var target = $body/target
|
||||
@onready var movement_shape = $MovementShape
|
||||
@@ -33,11 +34,12 @@ const MAX_AV = 10
|
||||
|
||||
|
||||
@onready var turret = $TurretLook/Turret
|
||||
@onready var turret_material = turret.mesh.surface_get_material(2)
|
||||
@onready var turret_material = turret.get_surface_override_material(2)
|
||||
|
||||
@export var stamina : Resource
|
||||
@export var ammo : Resource
|
||||
@export var money : Resource
|
||||
@export var health_pickup : Resource
|
||||
@export var die_particles : Resource
|
||||
@onready var turret_look = $TurretLook
|
||||
|
||||
@@ -90,7 +92,7 @@ func _on_area_3d_body_part_hit(dam,bullet_damage):
|
||||
if health <= 0:
|
||||
#remove from parent array
|
||||
get_parent().minions.erase(self)
|
||||
|
||||
level_control.enemy_count()
|
||||
particlespawn = die_particles.instantiate()
|
||||
particlespawn.position = self.global_position
|
||||
particlespawn.transform.basis = self.global_transform.basis
|
||||
@@ -98,7 +100,8 @@ func _on_area_3d_body_part_hit(dam,bullet_damage):
|
||||
|
||||
#pickup drop
|
||||
while number_of_drops > 0:
|
||||
var rand_selector = int(round(rng.randf_range(1,3)))
|
||||
level_control.pickup_spawn()
|
||||
var rand_selector = rng.randi_range(1,4)
|
||||
var lv_x = rng.randf_range(-MAX_LV,MAX_LV)
|
||||
var lv_y = rng.randf_range(0,MAX_LV)
|
||||
var lv_z = rng.randf_range(-MAX_LV,MAX_LV)
|
||||
@@ -113,6 +116,8 @@ func _on_area_3d_body_part_hit(dam,bullet_damage):
|
||||
rand_select = ammo
|
||||
3:
|
||||
rand_select = money
|
||||
4:
|
||||
rand_select = health_pickup
|
||||
# Random Item Drop
|
||||
rand_item = rand_select.instantiate()
|
||||
rand_item.position = self.global_position
|
||||
@@ -165,9 +170,9 @@ func _on_prefire_timer_timeout():
|
||||
func _on_postfire_timer_timeout():
|
||||
if turret_look_next.is_colliding() and turret_look_next.get_collider().is_in_group("player"):
|
||||
prefire_timer.start()
|
||||
turret_material.emission_enabled = true
|
||||
else:
|
||||
postfire_timer.start()
|
||||
turret_material.emission_enabled = true
|
||||
|
||||
|
||||
func _on_knocked_timer_timeout():
|
||||
|
||||
Reference in New Issue
Block a user