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.

AppGameKit Classic Chat / How do you rotate a sprite around it's centre (Offset Value)?

Author
Message
Rudders
12
Years of Service
User Offline
Joined: 20th Jan 2012
Location: Oxfordshire UK
Posted: 21st Apr 2012 18:34
Hi all,

I can rotate a sprite around it's top left corner but I cannot see any command for rotating around the offset point. Can someone please give me an idea... thanks
MarcoBruti
12
Years of Service
User Offline
Joined: 20th Nov 2011
Location: Caput Mundi
Posted: 21st Apr 2012 18:43
The setSpriteAngle command uses the offset point (set by setSpriteOffset) as centre of rotation. By default it is the centre of the sprite. It is the same for physic sprites and commands.

From the help:
Quote: "Immediately rotates the specified sprite to the given angle in degrees. By default sprites rotate around their center, see SetSpriteOffset to change this."
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 21st Apr 2012 19:00
Just use positionspritebyoffset(). That will automatically use the center of the sprite, unless you specify otherwise. If you rotate it then it should rotate correctly.

Rudders
12
Years of Service
User Offline
Joined: 20th Jan 2012
Location: Oxfordshire UK
Posted: 23rd Apr 2012 11:59
Thanks, simple really!
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 23rd Apr 2012 16:16
Sure is!

Login to post a reply

Server time is: 2024-05-04 13:02:47
Your offset time is: 2024-05-04 13:02:47