up until this point the game world was effectively limited to a single screen. While the player could move and jump on platforms, the entire level was always visible at once.
To fix this and move closer to a real platformer, I implemented a camera system using an offset value (offset_x).
This allows the player to move through a much larger world while the screen follows them smoothly.
Instead of drawing everything at fixed positions, all objects are now rendered relative to the camera position.
This is one of the most important structural changes in the entire project, because it transforms the game from a “static scene” into a scrolling level.
Problems Encountered
Problem 1: Everything moved incorrectly after adding camera
After introducing offset_x, all objects appeared shifted or misaligned.
Cause:
Objects were still being drawn using absolute coordinates.
Fix:
Updated draw calls to subtract camera offset:
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.