Skip to content

Make project camera follow overridable during bootstrap#1486

Merged
joeykchen merged 1 commit intogoplus:devfrom
joeykchen:fix/bootstrap-camera-follow-override
Apr 14, 2026
Merged

Make project camera follow overridable during bootstrap#1486
joeykchen merged 1 commit intogoplus:devfrom
joeykchen:fix/bootstrap-camera-follow-override

Conversation

@joeykchen
Copy link
Copy Markdown
Contributor

Summary

This changes the project-level camera.on behavior from a final bootstrap override to an initial default.

Before this change, runSpriteCallbacks applied the project camera target after all sprite Main functions had run, which meant a manual Camera.follow(...) inside MainEntry or sprite Main could be overwritten during bootstrap finalization.

With this change:

  • project camera.on is applied first as the default follow target
  • MainEntry, sprite Main, and OnLoaded can still override it later
  • a regression test is added to verify that a manual camera follow set during bootstrap remains the final result

Why

This makes bootstrap behavior match user expectation: hand-written camera follow logic should win if it runs later than the project default.

Testing

  • go test ./... -run TestRunSpriteCallbacksKeepsManualCameraFollowLast -count=1

Copy link
Copy Markdown
Contributor

@xgopilot xgopilot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found one reviewable gap: the implementation changes the bootstrap ordering as intended, but the added regression test only covers a sprite Main() override, not the other override points this PR now claims to preserve.

Copy link
Copy Markdown
Contributor

@xgopilot xgopilot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found after reviewing the bootstrap camera-follow ordering change and the added regression test. Verified that the new ordering is consistent with the existing bootstrap queue semantics, and go test ./... -run TestRunSpriteCallbacksKeepsManualCameraFollowLast -count=1 passed on commit 7b8817a1a673bbfb78ef2a4b9825d85b956b5283.

Copy link
Copy Markdown
Contributor

@xgopilot xgopilot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not find a functional regression in the reordered bootstrap camera logic. One test-coverage gap is worth tightening before this behavior claim spreads further.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request moves the default camera target initialization in runSpriteCallbacks to occur before sprite initializers are executed. This change ensures that bootstrap hooks, such as a sprite's Main method, can successfully override the project's default camera target. A new test case, TestRunSpriteCallbacksKeepsManualCameraFollowLast, has been added to verify this behavior. I have no feedback to provide.

@joeykchen joeykchen merged commit 2e0d46e into goplus:dev Apr 14, 2026
14 checks passed
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.

1 participant