Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / logic or math error?

Author
Message
Tamandt
19
Years of Service
User Offline
Joined: 23rd Dec 2004
Location:
Posted: 5th Mar 2012 01:38 Edited at: 5th Mar 2012 02:04
I have a problem where i draw tiles (sprites) on a screen. The Tiles will be moved left, right, down, up as those arrow keys are pressed. The entire screen is to be covered.

The big thing is I want to be able to stop the screen before the furthest most right (or down) tile can move past its last pixel (thus leaving a blank spot.



For reference pixelHeight is the number of the last pixel of the lowest tile. and pixelWidth containts the number of the last pixel of the right most tile

Heres what happens.. On the Y axis, it stops about two tiles too late (so in my case blank blue). On the X axis, it stops about 15 tiles too late? I have confirmed that pixelHeight,pixelWidth,dbScreenWidth, dbScreenHeight are all returning the correct numbers.

Thanks for your help.

edit: this might also be helpful

Tamandt
19
Years of Service
User Offline
Joined: 23rd Dec 2004
Location:
Posted: 5th Mar 2012 14:40
Figured it out. The for loops should be using the pixelWidth and pixelHeight (width and height of the lvl) and not the screen heigth and width. This is my updated code which seems to work fine.

Login to post a reply

Server time is: 2024-11-19 03:43:25
Your offset time is: 2024-11-19 03:43:25