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 / i am looking for maths routines for moving sprites in circles, sine etc using darkGDK

Author
Message
stevebrit
15
Years of Service
User Offline
Joined: 6th Jan 2009
Location: Florida USA
Posted: 29th Jan 2009 22:40
Hello all, does anyone know how i could get sprites to move in a given area in a circular fashion or any path thats predictable using x and y values within the screen resolution.
Thank you for reading this.

Regards Steve

AMD Athlon64x2 3.1Ghz - Ram 4Gb DDR2 800Mhz - 500Gb HD
Ndivia 9600GT SLI - 24in LCD - WIN 7 - 64 bit BETA
Scottie Dog
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location:
Posted: 30th Jan 2009 12:34
If you want to rotate around a point then...

PosX = dbSIN(i)*300 + PointX;
PosY = dbCOS(i)*300 + PointY;

Where i = angle of rotation. I.e, Make i count from 0 to 360, (1 a frame)
300 in this case is the size of the circle.
stevebrit
15
Years of Service
User Offline
Joined: 6th Jan 2009
Location: Florida USA
Posted: 3rd Feb 2009 00:17
thanks for that code it works very well do you know of any other snippets of code that would do the same thing but on a sine path of other path ??? thanks
regards :- Steve

AMD Athlon64x2 3.1Ghz - Ram 4Gb DDR2 800Mhz - 500Gb HD
Ndivia 9600GT SLI - 24in LCD - WIN 7 - 64 bit BETA
calcyman
17
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 3rd Feb 2009 08:20
PosX = dbSIN(i*57.295779513)*100 + PointX
PosY = i*100 + PointY

The optomist's right, The pessimist's right.
stevebrit
15
Years of Service
User Offline
Joined: 6th Jan 2009
Location: Florida USA
Posted: 3rd Feb 2009 18:27
Thank you calcyman wil try that snippet of code out.
regards :- Steve

AMD Athlon64x2 3.1Ghz - Ram 4Gb DDR2 800Mhz - 500Gb HD
Ndivia 9600GT SLI - 24in LCD - WIN 7 - 64 bit BETA

Login to post a reply

Server time is: 2024-11-25 13:31:19
Your offset time is: 2024-11-25 13:31:19