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 / Has anyone ever used the DBSetSpriteTextureCoord() command?

Author
Message
OceanJeff
15
Years of Service
User Offline
Joined: 5th Jan 2009
Location: Ocean Shores, WA
Posted: 5th Jan 2009 07:51
I am looking for a way to rotate a sprite around the center of the sprite 360 degrees.

I know there is a rotate sprite command, but it rotates around the top left.

Any help would be appreciated.

Later all, and thanks.

jeff

david w
18
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 5th Jan 2009 18:48
wow this is an easy one..

just get the size of your sprite and when you rotate it offset it by half that on the x and y.
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 5th Jan 2009 21:04
Use 'dbOffsetSprite()' to offset it by half its size, that'll change the origin to the center.


Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 6th Jan 2009 00:46
dbOffsetSprite(spritenum, dbSpriteWidth(spritenum)/2, dbSpriteHeight(spritenum)/2);
OceanJeff
15
Years of Service
User Offline
Joined: 5th Jan 2009
Location: Ocean Shores, WA
Posted: 7th Jan 2009 23:26
OMG, that works, but I swear that I tried that before!!! oh well.

So first you dbOffsetSprite (etc)
then you dbRotateSprite ( etc )!!!

and you have to keep track of the rotation and keep advancing it, because the sprite itself does not have that as an internal variable.

So, the call the dbRotateSprite ( spritenum, rotation );

and rotation is a float.

thanks guys, this is getting better and better.

more later,

jeff

Login to post a reply

Server time is: 2024-09-30 15:26:31
Your offset time is: 2024-09-30 15:26:31