Refine boss reveal and dash motion
This commit is contained in:
parent
8fbcc340ce
commit
e5439f7183
4 changed files with 48 additions and 11 deletions
|
|
@ -63,7 +63,7 @@ func _process(delta: float) -> void:
|
|||
return
|
||||
if not reveal_started:
|
||||
_update_indicator()
|
||||
if _boss_reaches_view():
|
||||
if _boss_is_fully_visible():
|
||||
begin_reveal()
|
||||
return
|
||||
if encounter_active:
|
||||
|
|
@ -98,17 +98,18 @@ func _set_combat_ui_visible(shown: bool) -> void:
|
|||
control.visible = shown
|
||||
|
||||
|
||||
func _boss_reaches_view() -> bool:
|
||||
func _boss_is_fully_visible() -> bool:
|
||||
# World-space math is immediate. The viewport canvas transform trails a
|
||||
# Camera2D assignment until the render server updates, which made a fast
|
||||
# approach able to cross the threshold one frame before the detector saw
|
||||
# it. Including the tentacle reach makes the reveal begin when the first
|
||||
# part of the creature actually touches the view.
|
||||
# it. The tentacles deliberately reach beyond the framing, so the authored
|
||||
# body radius is the useful cinematic boundary: the roar must wait until
|
||||
# the whole central creature is on screen, not fire when a tentacle enters.
|
||||
var half_view: Vector2 = get_viewport_rect().size * 0.5 / camera.zoom
|
||||
var extent: float = boss.TENTACLE_LENGTH * boss.scale.x
|
||||
var extent: float = boss.BODY_RADIUS * maxf(boss.scale.x, boss.scale.y)
|
||||
var separation: Vector2 = (boss.global_position - camera.global_position).abs()
|
||||
return separation.x <= half_view.x + extent \
|
||||
and separation.y <= half_view.y + extent
|
||||
return separation.x + extent <= half_view.x \
|
||||
and separation.y + extent <= half_view.y
|
||||
|
||||
|
||||
func _update_indicator() -> void:
|
||||
|
|
|
|||
Loading…
Reference in a new issue