Make project camera follow overridable during bootstrap#1486
Make project camera follow overridable during bootstrap#1486joeykchen merged 1 commit intogoplus:devfrom
Conversation
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Summary
This changes the project-level
camera.onbehavior from a final bootstrap override to an initial default.Before this change,
runSpriteCallbacksapplied the project camera target after all spriteMainfunctions had run, which meant a manualCamera.follow(...)insideMainEntryor spriteMaincould be overwritten during bootstrap finalization.With this change:
camera.onis applied first as the default follow targetMainEntry, spriteMain, andOnLoadedcan still override it laterWhy
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