Archived

This topic is now archived and is closed to further replies.

how to make level "borders"

This topic is 5013 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Alright, so im making a game that will be similar enough to pong that for simplicity i will just say thats what it is. I have a textured quad in the background that is the backdrop for the levels. im going to make the levels be a variable size in opengl units - eg 20x10 or 50x25. On the background texture there is a border, that i want the ball to stay inside. how do i scale the limits of the level with the size of the level, so the ball always stays inside the borders of the texture regardless of the size of opengl units? Thanks

Share this post


Link to post
Share on other sites
I would make borders a separate entity from the background, so that they dont change in width as the level expands. for instance, select 6 pixels as the width of your border. always draw four 6x6 corner pieces at the corners of your backdrop. then have two more images, one is 6x1 and one is 1x6. stretch these across the sides for the horizontal and vertical borders. Now you are guarenteed that your frame never gets stretched out of proportion, and the ball always bounces 6 in from any given side.

Share this post


Link to post
Share on other sites
The problem with that method is as the level size in OGL units gets bigger, the border will get smaller. i want to keep it the same size. FYI: the bottom "border" piece is the HUD

Share this post


Link to post
Share on other sites