Decreased movement and shot delay of enemies based on number of enemies
remaining; increased tween speed of enemy bounce at 25% remaining.
This commit is contained in:
parent
7a0ea55ff1
commit
f1eec30167
8 changed files with 57 additions and 5 deletions
16
main.gd
16
main.gd
|
|
@ -40,12 +40,28 @@ func spawn_enemies():
|
|||
print_debug("Remaining enemies: ", enemy_count, ", ", get_tree().get_nodes_in_group("enemies").size())
|
||||
|
||||
|
||||
|
||||
func _on_enemy_died():
|
||||
enemy_count -= 1
|
||||
print_debug(enemy_count)
|
||||
if enemy_count == 0:
|
||||
print_debug("Remaining enemies: ", enemy_count, ", ", get_tree().get_nodes_in_group("enemies").size())
|
||||
win_game()
|
||||
if enemy_count == ROWS * COLS / 2:
|
||||
print_debug("Enemy count is 50%")
|
||||
update_enemy_aggression(2,10)
|
||||
if enemy_count == ROWS * COLS / 4:
|
||||
print_debug("Enemy count is 25%")
|
||||
update_enemy_aggression(1,1)
|
||||
|
||||
func update_enemy_aggression(low,high):
|
||||
var nodes = get_tree().get_nodes_in_group("enemies")
|
||||
|
||||
for node in nodes:
|
||||
if node is Area2D:
|
||||
node.enemy_move_aggression = randf_range(low,high)
|
||||
node.enemy_shoot_aggression = randf_range(low,high)
|
||||
node.tween_speed = min(low,high) - .75
|
||||
|
||||
func _on_enemy_hit(value: int):
|
||||
Global.score += value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue