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! / Finding the angle of rotation, Please help

Author
Message
Evil Noodle
20
Years of Service
User Offline
Joined: 28th Apr 2003
Location:
Posted: 9th May 2003 13:29
Ok I have used the following code to determine the flight path of a missile

offsetx#=(power/2*(cos(angle#))*t#)
offsety#=(power/2*(sin(angle#))*t#-(0.5*gravity#)*(t#*t#))
missilex#=missilex#+offsetx#/4
missiley#=missiley#-offsety#/4

which looks fine if you have a dot for a missile however when i use a sprite ,it obviously dosnt rotate to match its sprite path , can anyone suggest how i would go about determining a suitable angle for each stage of the flight? at the moment it flies like a brick
T.A.F.K.A.C.M.O.T.D
The Artist Formally Known As Cut_Me_Own_Throat_Dibbler
haggisman
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 9th May 2003 19:12
I think you could place the offset values in the code you posted above in ATANFULL to return an angle that could be used to rotate the sprite.


Quote: "ATANFULL
This command will return the angle of two points in degrees between 0 and 360. The distance values are
calculated by finding the distance between two points for both the X and Y axis. The distance values can
be a real or integer number. The return value is a real number.

SYNTAX
Return Float=ATANFULL(Distance X, Distance Y)"


Specs:- 1GHZ athlon, Radeon8500, 192mb ram, winxp
Evil Noodle
20
Years of Service
User Offline
Joined: 28th Apr 2003
Location:
Posted: 10th May 2003 00:12
Thanks Haggisman , never noticed the atanfull command, Ive messed around with it briefly but still cant get the misile to rotate in line with the flight path ,oh well ill just keep trying

T.A.F.K.A.C.M.O.T.D
The Artist Formally Known As Cut_Me_Own_Throat_Dibbler
Evil Noodle
20
Years of Service
User Offline
Joined: 28th Apr 2003
Location:
Posted: 10th May 2003 01:45
Ahahaaaa Its working ,cheers Haggisman

T.A.F.K.A.C.M.O.T.D
The Artist Formally Known As Cut_Me_Own_Throat_Dibbler

Login to post a reply

Server time is: 2023-09-27 13:04:10
Your offset time is: 2023-09-27 13:04:10