Add tentacled boss planet encounter
This commit is contained in:
parent
0f7edff15a
commit
40f284dcdd
38 changed files with 1051 additions and 19 deletions
|
|
@ -1,6 +1,8 @@
|
|||
class_name GasBombEffect
|
||||
extends Node2D
|
||||
|
||||
const COMBAT_TARGET = preload("res://core/CombatTarget.gd")
|
||||
|
||||
# The gas bomb itself: the flight, the blast and the picture of both, with
|
||||
# nothing in it about who threw it.
|
||||
#
|
||||
|
|
@ -67,13 +69,11 @@ func _explode() -> void:
|
|||
exploded = true
|
||||
explosion_time = EXPLOSION_DURATION
|
||||
hit_count = 0
|
||||
# Asteroids too - a blast that clears everything around it but leaves the
|
||||
# rocks untouched would need explaining, and they take damage the same way.
|
||||
#
|
||||
# Every weapon target opts into the same damage contract: ordinary enemies,
|
||||
# asteroids, boss hatchlings and opened boss eyes all belong here.
|
||||
# #176: player weapons never damage player buildings. A bomb may be thrown
|
||||
# into a siege without punishing the structure it is meant to defend.
|
||||
for target_node in get_tree().get_nodes_in_group("enemies") \
|
||||
+ get_tree().get_nodes_in_group("asteroids"):
|
||||
for target_node in get_tree().get_nodes_in_group(COMBAT_TARGET.GROUP):
|
||||
if is_instance_valid(target_node) and target_node is Node2D \
|
||||
and target_node.global_position.distance_to(target) <= AOE_RADIUS:
|
||||
target_node.take_damage(damage)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
class_name LaserBeamEffect
|
||||
extends Node2D
|
||||
|
||||
const COMBAT_TARGET = preload("res://core/CombatTarget.gd")
|
||||
|
||||
# The laser shot itself: the strike and the picture of it, with nothing in it
|
||||
# about who fired or why.
|
||||
#
|
||||
|
|
@ -71,11 +73,9 @@ static func fire(world: Node, origin: Vector2, direction: Vector2,
|
|||
func _strike(direction: Vector2, damage: int) -> void:
|
||||
hit_count = 0
|
||||
var range_along: float = from.distance_to(to)
|
||||
# Asteroids share the enemies' take_damage() contract, so the beam sweeps
|
||||
# both groups in one pass. Shooting a path clear through a field is a
|
||||
# perfectly good use of a laser, and the ore it leaves behind is the point.
|
||||
for enemy in get_tree().get_nodes_in_group("enemies") \
|
||||
+ get_tree().get_nodes_in_group("asteroids"):
|
||||
# Every attackable composition shares this contract, including opened boss
|
||||
# eyes. Shooting a path through an asteroid field still works unchanged.
|
||||
for enemy in get_tree().get_nodes_in_group(COMBAT_TARGET.GROUP):
|
||||
if not is_instance_valid(enemy) or not (enemy is Node2D):
|
||||
continue
|
||||
var to_enemy: Vector2 = enemy.global_position - from
|
||||
|
|
|
|||
Loading…
Reference in a new issue