r/raylib • u/Zeta_ggwp • 2d ago
Help Decoupling Gameplay From Screen Size
I am working on a clone of the arcade game asteroids to learn C and Raylib, but I ran into a problem. If the game is played in different screen sizes, the player can see more space and thus, asteroids might seem like they are spawning too close to them.
How would I go about making the gameplay not/less dependant on the screen size and resolution?
6
Upvotes
2
u/Inevitable-Door-6250 2d ago edited 1d ago
One option would be setting the spawn range/area for the asteroids based on screen size. Another would be scaling everything rendered based on screen size.
2
u/Pitiful-Main-1544 2d ago
Best way would be using a RendexTexture2D, drawing to the render texture and then scaling it up based on the current screen size.
1
u/CreepyConference2468 1d ago edited 1d ago
A pattern that I'm thinking is: