Recommended Posts

Hey everyone, so I FINALLY started programming again after a bit of a hiatus. I am starting a 2d pong game (for kicks and giggles). However I've run into a problem. I'm trying to use one BIG graphic with all the tiles on it, and then break up all the tiles into smaller graphics.
My big graphic (shown below):
is 208 x 150.
My first paddle should be 29 x 75.
However when I do the dimensions in C++ it is wrong!
Here's a snippet from my code:

Share this post

Link to post

Share on other sites

i should define it as 29x75... however, for whatever reason, if i define it like that then it comes up short (it doesn't show the whole image, just a small piece of that) only when i use 48x120 do i get the WHOLE image!

0

Share this post

Link to post

Share on other sites

Your image is probably being resized to a power of 2 when it's loaded, in this case 256x256. That would throw off your coordinates. You should make your master image dimensions powers of 2 so that the resizing doesn't occur. You can just fill any unused space with your background/transparent color.