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 / sprite angle.

Author
Message
Serengeor
15
Years of Service
User Offline
Joined: 17th Jan 2009
Location: Lithuania/lietuva
Posted: 27th Jan 2009 21:59
Ok im creating 2D sidescroller shooter game.
and i would like to know how could make some sprite rotate with my mouse moving ? like the arm to follow the mouse.

GDK Developer since now
Quadrazar
15
Years of Service
User Offline
Joined: 7th Jan 2009
Location: onboard the Kobayashi Maru
Posted: 27th Jan 2009 23:13 Edited at: 27th Jan 2009 23:15
Rotating a sprite is done by dbRotateSprite(). Problem is that it will rotate the sprite around the upper left corner. For a shooter game you want it to turn aroud a predefined pivot point. Setting a pivotpoint for a sprite in GDK this is done by dbOffestSprite() command. Use dbMouseX() and dbMouseY() to get the mousepossition.
Use some gonimetric calculations to do the aiming.

Amiga 500 - 68000 processor / 7 Mhz, 512 Kb RAM, 4-channel PCM synthesizer (stereo)
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 28th Jan 2009 01:03


Excerpt from the game I'm working on.
Serengeor
15
Years of Service
User Offline
Joined: 17th Jan 2009
Location: Lithuania/lietuva
Posted: 28th Jan 2009 09:02
@Quadrazar
could you give me a sample code? so i can get what you mean

GDK Developer since now

Login to post a reply

Server time is: 2024-11-25 13:14:21
Your offset time is: 2024-11-25 13:14:21