more hivemind tweaks and added enemy counter to level manager
This commit is contained in:
@@ -13,6 +13,8 @@ var ammo_reserve = [0]
|
||||
var guns_dict = {}
|
||||
var current_gun_index
|
||||
var particle_number = 0
|
||||
var enemy_hiveminds = []
|
||||
var remaining_enemies
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
@@ -34,10 +36,16 @@ func _ready():
|
||||
# Spawn first gun
|
||||
current_gun_index = 0
|
||||
gun_spawn(0)
|
||||
|
||||
#find enemy hiveminds
|
||||
for node in get_tree().get_nodes_in_group("enemy_hivemind"):
|
||||
enemy_hiveminds.append(node)
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta):
|
||||
pass
|
||||
for hivemind in enemy_hiveminds:
|
||||
remaining_enemies = hivemind.minions.size()
|
||||
print("remaining enemies: " + str(remaining_enemies))
|
||||
|
||||
func gun_spawn(index):
|
||||
#loop around if scrolling past available guns
|
||||
|
||||
@@ -38,11 +38,12 @@ func _process(delta):
|
||||
position += transform.basis * Vector3(0, 0, -bullet_speed) * delta
|
||||
rotation.x = clamp(rotation.x - delta * bullet_drop,deg_to_rad(-90),deg_to_rad(90))
|
||||
|
||||
if ray.is_colliding() and ray.get_collider().is_in_group("player"):
|
||||
var player = ray.get_collider()
|
||||
player.level_control.health -= bullet_damage
|
||||
player.hurt_audio.play()
|
||||
queue_free()
|
||||
if ray.is_colliding():
|
||||
if ray.get_collider().is_in_group("player"):
|
||||
var player = ray.get_collider()
|
||||
player.level_control.health -= bullet_damage
|
||||
player.hurt_audio.play()
|
||||
queue_free()
|
||||
|
||||
if ray.is_colliding() and !ray.get_collider().is_in_group("player"):
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ func _process(delta):
|
||||
turret_look_next.look_at(player.global_position,Vector3.UP)
|
||||
turret_look.rotation = lerp(turret_look.rotation,turret_look_next.rotation,delta * turret_look_speed)
|
||||
|
||||
distance_to_player = abs(self.global_position - player.global_position)
|
||||
#distance_to_player = abs(self.global_position - player.global_position)
|
||||
|
||||
#apply gravity
|
||||
if !is_on_floor():
|
||||
|
||||
Reference in New Issue
Block a user