Draw capture points behind fleet vessels (#50)
CapturePoint.gd left z_index at its default 0, the same layer Ship draws on, so a ship parked inside a ring was partly swallowed by the ring fill - exactly where the player most needs to see their own vessels. Set z_index = -1, matching the convention every other world object already follows (Planet, Rock, Building, Hauler, Transporter, VesselDelivery). Verified with a ship placed directly on a capture point in the preview screenshot, and asserted in test_capture_points.gd.
This commit is contained in:
parent
df2f252970
commit
5b2dd77e47
3 changed files with 12 additions and 1 deletions
|
|
@ -28,6 +28,12 @@ var state: int = State.NEUTRAL
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
# Behind the fleet and enemies, same convention as every other world
|
||||||
|
# object that must never occlude them (Planet.gd, Rock.gd, Building.gd,
|
||||||
|
# Hauler.gd, Transporter.gd, VesselDelivery.gd all set this in _ready()).
|
||||||
|
# "Is an enemy inside my capture radius" is the core read of this
|
||||||
|
# mechanic, so a ship or enemy sitting in the ring must stay fully visible.
|
||||||
|
z_index = -1
|
||||||
queue_redraw()
|
queue_redraw()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,10 @@ func _ready() -> void:
|
||||||
|
|
||||||
# Lay the three points out in a compact, clearly-separated triangle for
|
# Lay the three points out in a compact, clearly-separated triangle for
|
||||||
# the screenshot, rather than the real (far-flung) authored positions.
|
# the screenshot, rather than the real (far-flung) authored positions.
|
||||||
var layout: Array = [Vector2(300, 150), Vector2(-300, 150), Vector2(0, -280)]
|
# Point 0 sits at the origin - exactly where the fleet spawns - so the
|
||||||
|
# screenshot also proves the #50 z_index fix: the ring must not occlude
|
||||||
|
# the ships parked on top of it.
|
||||||
|
var layout: Array = [Vector2(0, 0), Vector2(-300, 150), Vector2(300, -200)]
|
||||||
for i in range(mini(points.size(), layout.size())):
|
for i in range(mini(points.size(), layout.size())):
|
||||||
points[i].position = layout[i]
|
points[i].position = layout[i]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -197,6 +197,8 @@ func _process(delta: float) -> bool:
|
||||||
# through the build UI here to avoid duplicating that coverage.
|
# through the build UI here to avoid duplicating that coverage.
|
||||||
if not game_state.is_planet_conquered(planet_id):
|
if not game_state.is_planet_conquered(planet_id):
|
||||||
return _fail("single-point planet was not marked conquered")
|
return _fail("single-point planet was not marked conquered")
|
||||||
|
if point.z_index >= 0:
|
||||||
|
return _fail("capture point does not draw behind the fleet/enemies (z_index=%d)" % point.z_index)
|
||||||
|
|
||||||
print("TEST_CAPTURE_POINTS: PASS")
|
print("TEST_CAPTURE_POINTS: PASS")
|
||||||
quit(0)
|
quit(0)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue