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.

2D All the way! / rotating a sprite 360 degrees need to know how

Author
Message
UnderLord
20
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 9th Feb 2004 21:14 Edited at: 9th Feb 2004 23:20
this is what i have right now



i want to know how to rotate it in all directions while not moving.


edit
Well maybe a better example is needed. I want to make it turn in a full 360 degrees while not moving so that way you can stay in one spot but still shoot at the enemy or something like that. You guys should know what i mean you guysh ave played 2d games befor (space games) how they always have it so you can turn your ship in 360 degree's you know.

The search continues.
spooky
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 10th Feb 2004 00:29
If you mean like asteroids, then you only need 1 sprite and then use ROTATE SPRITE to rotate to any angle.

Boo!
UnderLord
20
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 10th Feb 2004 05:17 Edited at: 10th Feb 2004 06:10
yeah i mean exactly like astroids except i did the rotate command and i want it to rotate from, start to end and let you see the whole rotation (360 degrees) but when i do the rotate sprite command it will only rotate to that angle and then stop.

btw im using DBP

The search continues.
CloseToPerfect
21
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 10th Feb 2004 08:31
ship = 1
ship_image = 1
angle = 0
ship_x_pos = screen width() / 2
ship_y_pos = screen height() / 2
load image "ship",ship_image,1

do
if left key() then inc angle ,1 : if angle > 359 then angle = 0
if right key() then dec angle ,1 : if angle < 0 then angle = 359
rotate sprite ship ,angle
sprite ship ,ship_x_pos ,ship_y_pos ,ship_image
loop

you will have to set the sprite offset to the center of the ship image so it will rotate on the center and not the upper left which is default.

RGT may be gone but the best DBP forum is still alive and kicking, check it out.
http://www.dannywartnaby.co.uk/rgt/
UnderLord
20
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 10th Feb 2004 15:59
wow with alot of work that could work fine

The search continues.
Tersaken
20
Years of Service
User Offline
Joined: 15th Dec 2003
Location: France ( Rennes )
Posted: 10th Feb 2004 16:26


Athlon 1700+ ; 256 Mo DDR ; GeForce Fx 5600 128 Mo.
NoOnE
20
Years of Service
User Offline
Joined: 8th Feb 2004
Location: Erm
Posted: 11th Feb 2004 02:41 Edited at: 11th Feb 2004 02:46
s

time is money, but pleasure is priceless!
UnderLord
20
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 11th Feb 2004 22:19


i edited the code a little once i get off work though i'll take the code and make it a little better but that will get me off to a start thanks tersaken.

The search continues.

Login to post a reply

Server time is: 2024-05-12 20:23:14
Your offset time is: 2024-05-12 20:23:14