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 / Rotation issues

Author
Message
Neon Sheild
14
Years of Service
User Offline
Joined: 27th Aug 2010
Location: Mt. Olympus
Posted: 9th Dec 2010 06:23
Hey guys,

I'm making a 2D game, where essentially the player is a little arrow in the center of the screen. The circle doesn't move, but by pressing the arrow keys the world/level rotates around them (with the world constantly moving downwards), with the objective being to reach the end of the level without hitting any walls.

My issue, though, is that when I use dbRotateSprite(), it rotates the world around its upper left corner, the x-coordinate. How would I rotate it around any other given point on the sprite, say, for example, the circle in the middle of the screen?

Thanks in advance

Perhaps, I theoretically might possibly have potential to hypothetically maybe have the chance to attempt something.
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 9th Dec 2010 11:21
Look for dbOffsetSprite(), you offset it by half its width and half its height, then it will behave when rotating.

Neon Sheild
14
Years of Service
User Offline
Joined: 27th Aug 2010
Location: Mt. Olympus
Posted: 10th Dec 2010 06:33
hm...it doesn't seem to be working. Whenever I offset it, the sprite just jumps to some other position...

Perhaps, I theoretically might possibly have potential to hypothetically maybe have the chance to attempt something.
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 10th Dec 2010 16:33
Yeah, it will change position, you just do it once at the start.
To be sure its working, keep the sprite at 0,0 then offset it until the centre is at 0,0, if the centre is at 0,0 then you should only see the bottom right corner of the sprite in the top left hand side of the screen.

If you can't get it working then post the code and someone will point you in the right direction.

Login to post a reply

Server time is: 2024-09-28 14:09:51
Your offset time is: 2024-09-28 14:09:51