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 / how to rotate a sprite?

Author
Message
squids
21
Years of Service
User Offline
Joined: 1st May 2003
Location: United Kingdom
Posted: 11th Jun 2003 13:11
Hey,

I cant quite ge this right. Any ideas on how I can rotate a sprite 360 degrees over a 1 second lapse(roughly). That make any sense?

Thank you,
Ash.
.Arf..
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 11th Jun 2003 13:18
Assuming a sync rate of 60, you could use something like this:

squids
21
Years of Service
User Offline
Joined: 1st May 2003
Location: United Kingdom
Posted: 11th Jun 2003 13:25
How was that so easy for you, lol. Thanks

I spent a while trying to get it to rotate,.. I suck,!

Just wondering,. The sprite I am rotating is a rectangle (pong paddle basically).. How would I go about making it rotate from its center and not its like top left coords. Any Ideas?

Cheers,
Ash.

.Arf..
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 11th Jun 2003 13:28
Just use the OFFSET SPRITE command to move it's positioning/rotation point to its centre.

OFFSET SPRITE 1, SPRITE WIDTH(1)/2, SPRITE HEIGHT(1)/2
squids
21
Years of Service
User Offline
Joined: 1st May 2003
Location: United Kingdom
Posted: 11th Jun 2003 13:43 Edited at: 11th Jun 2003 13:45
Ah, okay.

Thank you, that has totally solved my problem however one very final question. When using this:


It works fine, but now I am having a blue screen problem after it has rotated >.< it flashes to a blue screen after it has rotated the sprite.

Ive tried CLS sync and set current bitmap all over it but, you guessed it I cant make it work without flashing to the blue screen Any idea what I could try ?

Does that make sense?
Soz,
Ash.

.Arf..
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 11th Jun 2003 13:49
Download and have a read of a tutorial specifically for this problem.

http://www.darkbasicpro.com/tutorials.php - It's tutorial 10 you need to look at. That will give you several methods of dealing with this, and you can pick the most appropriate one.
squids
21
Years of Service
User Offline
Joined: 1st May 2003
Location: United Kingdom
Posted: 11th Jun 2003 14:00
couldnt quite get anything to work,. but hey,. I got it down to a real quick blue flick,. better than nothing,. Thanks a lot for the help.

Ash.

.Arf..
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 11th Jun 2003 14:04
Another 'quick' method I've used is to set the backdrop colour:

COLOR BACKDROP rgb(0,0,0)

I either use that, or switch off the backsave option on the sprites.
squids
21
Years of Service
User Offline
Joined: 1st May 2003
Location: United Kingdom
Posted: 11th Jun 2003 14:06 Edited at: 11th Jun 2003 14:07
Ill have a play with it all, cheers dude.

.Arf..

Login to post a reply

Server time is: 2024-09-20 12:59:14
Your offset time is: 2024-09-20 12:59:14