-5
\$\begingroup\$

I'm making a game, and have the screen done. but now, I want to make a world. But I don't know how to make the world larger than the screen. My screen is 800x600, I want the worldsize about 3x that.

\$\endgroup\$
1
  • \$\begingroup\$ What are you specifically having trouble with? Making a camera view that can pan around a larger playfield? Representing the playfield in memory? Creating the assets for the playfield? Please clarify your question. \$\endgroup\$
    – user1430
    Jan 4, 2016 at 16:23

1 Answer 1

3
\$\begingroup\$

The question itself is a little vague, but it looks like what you're asking is "How do I create elements beyond the boundaries of my screen?"

A common way is to implement a camera system, and using the position of this camera to determine what is being rendered on screen and where it is located. In this system, all objects in-world are positioned using world coordinates (where the object is in world), and the camera is positioned using these same coordinates. Then during your rendering method, you determine which objects exist within view of your camera, and translate them to view coordinates (where the object exists on screen) to draw them.

Image of a camera setup

Some psuedocode on draw:

for each object in allObjects
{
    if (camera.contains(object))
    {
        drawObject(object.x - camera.x, object.y - camera.y)
    }
}
\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged .