#139: the prologue's debris belt keeps off the screen too
The belt was laid out with its own arithmetic - a centre BELT_AHEAD in front of the fleet, rocks spread BELT_DEPTH either side of it - so its near edge reached back to within a screen of the convoy. At the aspect it was eyeballed on that was just outside the view; at a wider one, or any zoom out, rocks appeared in plain sight. #126 already answered this question for the rest of the game, so the answer is borrowed rather than restated: AsteroidField's keep-out rect and its push-out-through-the-nearest-edge placement are public now, and the belt runs through them. That also means the two cannot drift apart later. The distance moves as well, 2200 to 2900. The clamp alone would work, but it would work by pressing every stray rock onto the boundary line; with the belt properly out in front, the clamp has almost nothing left to do and the belt still looks laid out ahead rather than pinned to the edge of the screen. Measured: nearest rock 1551 units out, against a keep-out that reaches 1100.
This commit is contained in:
parent
1ece202731
commit
ac4b96ef49
6 changed files with 51 additions and 144 deletions
|
|
@ -59,7 +59,12 @@ const AMBUSH_AHEAD: float = 1100.0
|
|||
# #125: the run was over in about four seconds at cruise. Far enough now
|
||||
# that the convoy is genuinely under way before anything interrupts it.
|
||||
const RUN_DISTANCE: float = 3400.0
|
||||
const BELT_AHEAD: float = 2200.0
|
||||
# #139: far enough that the near edge of the belt is well past the screen
|
||||
# even before the keep-out below trims it. The two together, rather than
|
||||
# either alone: the distance keeps the belt looking laid out ahead rather
|
||||
# than pinned to the screen edge, and the keep-out is what actually
|
||||
# guarantees nothing appears in view at any aspect ratio or zoom.
|
||||
const BELT_AHEAD: float = 2900.0
|
||||
const BELT_ROCKS: int = 90
|
||||
const BELT_HALF_WIDTH: float = 2600.0
|
||||
const BELT_DEPTH: float = 1400.0
|
||||
|
|
@ -422,12 +427,22 @@ func _spawn_belt() -> void:
|
|||
rock.queue_free()
|
||||
rocks.clear()
|
||||
belt_at = fleet.get_centroid() + Vector2(0.0, -BELT_AHEAD)
|
||||
# #139: rocks were popping into existence on screen. The belt is spread
|
||||
# BELT_DEPTH either side of its centre, so its near edge reached back to
|
||||
# within a screen of the fleet - and at a wider aspect than the one it
|
||||
# was eyeballed on, into the view outright.
|
||||
#
|
||||
# The rule is the asteroid field's own (#126), borrowed rather than
|
||||
# restated here: anything that lands in view is pushed out through the
|
||||
# nearest edge, so the belt keeps its density instead of thinning where
|
||||
# the player is looking.
|
||||
var keep_out: Rect2 = asteroid_field.keep_out_rect(fleet.get_centroid())
|
||||
var scene: PackedScene = load("res://world/Asteroid.tscn")
|
||||
for i in range(BELT_ROCKS):
|
||||
var rock: Node2D = scene.instantiate()
|
||||
rock.position = belt_at + Vector2(
|
||||
rock.position = asteroid_field.safe_position(belt_at + Vector2(
|
||||
randf_range(-BELT_HALF_WIDTH, BELT_HALF_WIDTH),
|
||||
randf_range(-BELT_DEPTH, BELT_DEPTH))
|
||||
randf_range(-BELT_DEPTH, BELT_DEPTH)), keep_out)
|
||||
get_parent().add_child(rock)
|
||||
rocks.append(rock)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue