forums

TNT Basic Forums > Programming Q&A
Turret aiming...
< Last Thread     Next Thread >
Author
Thread        Post A Reply

02-28-2002 21:18

Posted by:
MiniMe

Find more posts by MiniMe

I want an enemy turret aiming at the player, the turret has 36 frames and I only have the X and Y pos of each(player and turret). How do you do this?

03-01-2002 15:59

Posted by:
Daniel Lurie

Click Here to Email Daniel Lurie   Find more posts by Daniel Lurie

I assume each frame represents 10 degrees, yes? Now assume, the first (zero degree frame) is the turret pointing due east.

Subtract the turret center's y from the player's center's y, then
subtract the turret center's x from the player's center's x, then
divide the difference in y by the difference in x.

Now, use invtan to get the angle in degrees from the turret to the player.

If the player is to the left, add 180 degrees.

Then round to the nearest multiple of 10, and you know which frame to use for your turret.

03-02-2002 18:45

Posted by:
MiniMe

Find more posts by MiniMe

Thanks

Thanks man, it worked but I didn't need to do that last bit.

03-04-2002 22:18

Posted by:
Daniel R. Lurie

Click Here to Email Daniel R. Lurie   Find more posts by Daniel R. Lurie

Cool. Post it sometime.

03-05-2002 15:59

Posted by:
MiniMe

Find more posts by MiniMe

The code or the game?

03-06-2002 19:18

Posted by:
Tony Rose

Click Here to Email Tony Rose   Find more posts by Tony Rose

I would like to see..

I would be interested in taking a look at the code,and the game if you would like to show it off. If you dont mind,perhaps send the file to my email addy at muzein@jg26.org . I am going to be adding turrets to my game soon and would like to see some examples.

03-06-2002 19:38

Posted by:
ERaZer

Find more posts by ERaZer

Sorry, but I can't send you the file becouse:
1. The damn file wont open and I dont know what to do. It says that the resource map is inconsistent with the operation... And I haven't backed it up :(
2. The code aint that good and the graphics sux.
I would however post the turret code if it wasen't for the 1 up there.

03-15-2002 16:40

Posted by:
Tony Rose

Click Here to Email Tony Rose   Find more posts by Tony Rose

Help plz!

Ok,I tryed,but I really am not good at math (Maybe I shouldnt take up programming eh?) and I dont fully understand all the commands of TNT Basic yet either. If someone could PLEASE post an actualy working example of the code or send me one at muzein@jg26.org I would be very grateful!

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.