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.

Newcomers DBPro Corner / Rotating 2D Objects

Author
Message
Allen Moore
21
Years of Service
User Offline
Joined: 28th Jan 2003
Location:
Posted: 28th Jan 2003 17:28
I've tried to do some manual searching in these forums with no luck. Ideally there would be a search button to assist in searching though these forums. I've just gotten the trial demo, and was playing around with the sprite rotate function, however I was wondering if there was a way to rotate an object from the middle as oppose to it's upper middle, or upper left hand corner. The default way it rotates is not the desired effect I was looking for. If anyone could help, I'd be greatly appreciative.
Allen Moore
21
Years of Service
User Offline
Joined: 28th Jan 2003
Location:
Posted: 28th Jan 2003 18:09
By the way, incase it makes a difference... i'm using Dark Basic Pro Trial Demo. Thank you.

Richard Davey
Retired Moderator
22
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 28th Jan 2003 18:39
Use the offset sprite command to shift the hotspot (and thus, point of rotation) from the corner to the middle.

The code is pretty simple:

offset sprite spr, x, y

where spr = your sprite
x = half the width of your sprite
y = half the height of your sprite

You can also offset to other areas of course which make for interesting rotation effects.

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
Allen Moore
21
Years of Service
User Offline
Joined: 28th Jan 2003
Location:
Posted: 28th Jan 2003 21:59
Great thank you! I wondered if the offset command wasn't the key, however I wasn't fully sure how to go about utilizing it. Thanks again.

Login to post a reply

Server time is: 2024-11-23 22:36:15
Your offset time is: 2024-11-23 22:36:15