#130 asked for the hull to break away from the fleet, drift a few metres, and go up further off with something more explosive than a light animation. The wreck is a separate node rather than the Ship staying alive to animate, and that is the load-bearing part. A dying Ship still in the tree is still an Area2D in the player_ships group with live weapon components - it would keep firing, keep being fired at, keep counting as a target, and keep colliding on the way out. So the ship's own lifecycle is untouched: it leaves the fleet, emits destroyed, and is freed on exactly the frame it always was. What is left behind is scenery, and the test pins that. The explosion at the end was also the quieter of the two the game has. Killing an enemy was made deliberately loud by #87 while losing one of your own kept the base class's twelve-particle default - the reward louder than the loss. It is now the bigger of the two. #135 is the same scene from the other end: the prologue's convoy flies its escorts on the corners of the box, which is the exposed part of it, and the debris belt can take all four. With no interceptor left, the only hulls the vortex could spare were holds, and the player flew out of the prologue in a carrier. Two guards now: one interceptor is put back into the convoy at the top of the vortex, where a vessel appearing among ten being thrown around a black hole is not something anyone will catch; and the handover checks the TYPES it hands over rather than only the count - one surviving carrier is also a fleet of one, and it is not the fleet a new game starts with.
This commit is contained in:
parent
397983b611
commit
710dcbf230
8 changed files with 419 additions and 6 deletions
|
|
@ -170,12 +170,31 @@ func take_damage(_amount: int) -> bool:
|
|||
for child in get_children():
|
||||
if child.has_method("absorb_hit") and child.absorb_hit():
|
||||
return true
|
||||
ShipExplosionVFX.spawn(get_tree().root, position)
|
||||
# #130: the hull comes off the formation and explodes further out, rather
|
||||
# than going up on the spot. The wreck is its own node - this one is
|
||||
# still freed on this frame, so nothing about who is in the fleet, who
|
||||
# can be shot, or who is a target changes.
|
||||
ShipWreckVFX.spawn(get_tree().root, self, _breakaway_direction())
|
||||
destroyed.emit()
|
||||
queue_free()
|
||||
return false
|
||||
|
||||
|
||||
# Which way is "out of the fleet". Away from the formation's own centre, so a
|
||||
# wreck leaves the wedge instead of tumbling back through it; a ship flying
|
||||
# alone - or one not under a Fleet at all - simply carries on the way it was
|
||||
# already pointed.
|
||||
func _breakaway_direction() -> Vector2:
|
||||
var parent: Node = get_parent()
|
||||
if parent != null and parent.has_method("get_centroid"):
|
||||
var out: Vector2 = position - (parent.get_centroid() as Vector2)
|
||||
if out.length() > 1.0:
|
||||
return out.normalized()
|
||||
if velocity.length() > 1.0:
|
||||
return velocity.normalized()
|
||||
return Vector2.UP.rotated(rotation)
|
||||
|
||||
|
||||
func _on_area_entered(area: Area2D) -> void:
|
||||
if not (area.is_in_group("enemies") or area.is_in_group("asteroids")):
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in a new issue