Skip to content

Do not assume class of first node in group player#2369

Open
manuq wants to merge 2 commits into
mainfrom
improve-getting-player-node
Open

Do not assume class of first node in group player#2369
manuq wants to merge 2 commits into
mainfrom
improve-getting-player-node

Conversation

@manuq

@manuq manuq commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

So cinematics can assign "player" group to the mock player sprite.

This makes the dialogue balloon to appear at the top of the screen when the
sprite is at the bottom.

Do not assume class of first node in group player

Certain scripts could treat player as a CharacterBody2D for physics,
as a Node2D for its position, or as a CanvasItem for visual stuff, etc.

Input HUD: It considers the player a CharacterBody2D and checks for its
components using Object.get(COMPONENT_NAME) as COMPONENT_CLASS. Previously it
was assuming that the output of get_first_node_in_group() was a
CharacterBody2D. The assignment would fail if the first node in group "player"
is of another type. This doesn't allow mock players, for example an
AnimatedSprite2D in a cinematic.

Throwing enemy: All this enemy needs is the global_position of player for
throwing. This makes it closer to the ThrowProjectileBehavior which has @export var target: Node2D. Also get the player node from group "player" only once.

player_follower.gd: All this script needs is the global_position of player
for calculating the offset.


Fix #2306

Input HUD: It considers the player a CharacterBody2D and checks for its
components using `Object.get(COMPONENT_NAME) as COMPONENT_CLASS`. Previously it
was assuming that the output of `get_first_node_in_group()` was a
CharacterBody2D. The assignment would fail if the first node in group "player"
is of another type. This doesn't allow mock players, for example an
AnimatedSprite2D in a cinematic.

Throwing enemy: All this enemy needs is the global_position of player for
throwing. This makes it closer to the ThrowProjectileBehavior which has `@export
var target: Node2D`. Also get the player node from group "player" only once.

player_follower.gd: All this script needs is the global_position of player
for calculating the offset.
@manuq manuq requested review from a team as code owners June 12, 2026 19:03
@manuq manuq marked this pull request as draft June 12, 2026 19:03
@github-actions

Copy link
Copy Markdown

Play this branch at https://play.threadbare.game/branches/endlessm/improve-getting-player-node/.

(This launches the game from the start, not directly at the change(s) in this pull request.)

@manuq

manuq commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator Author

I only made the change in Renya intro for testing. But if we agree on this solution, at least for the existing cinematics, then I can update them all. Link to watch the test scene:

https://play.threadbare.game/branches/endlessm/improve-getting-player-node/#quests/story_quests/renya_beyond_sorrow/0_intro/renya_intro

This makes the dialogue balloon to appear at the top of the screen when the
sprite is at the bottom.

Fix #2306
@manuq manuq force-pushed the improve-getting-player-node branch from dc85a76 to fa79280 Compare June 12, 2026 21:35
@manuq manuq marked this pull request as ready for review June 13, 2026 04:17
@manuq manuq requested review from a team as code owners June 13, 2026 04:17
@manuq

manuq commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator Author

I updated all the cinematic scenes now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New dialogue balloon placement obscures "player" in quest intro/outro cutscenes

1 participant