Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Calculate angle between two points
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Bored




PostPosted: Sun Mar 20, 2005 6:55 pm   Post subject: Calculate angle between two points

Heres the deal. I have a two player version of a little space game here. I want to make a one player version by making the second player into an ai. I thought i'd go about it by fist having him chase you and try to shoot you and work my way from there. To hav him chase you he must be able to able to calculate the angle at which the other player is so he will know which way to travel. What i need from you guys is how to do this. Just for reference upwards is 0 degrees and the controls are
P1:
Up=Forward
Down=Backward
Left=Turn Left
Right=Turn Right
Ctrl=Sharp Turn
Shift=Shoot
Enter=Change Weapon
P2:
W=Forward
S=Backward
A=Turn Left
D=Turn Right
E=Sharp Turn
Tab=Shoot
Q=Change Weapon



spacey game thingy.t
 Description:
The Game

Download
 Filename:  spacey game thingy.t
 Filesize:  11.1 KB
 Downloaded:  283 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Mr. T




PostPosted: Sun Mar 20, 2005 7:09 pm   Post subject: (No subject)

nice little game, i like the way the bullets bounce off the planet thing...
one way of fixing the game, would be by decreasing the amount of hits it takes to destroy the planet... it took me 5 minutes of firing to destroy one Surprised
Cervantes




PostPosted: Sun Mar 20, 2005 7:16 pm   Post subject: (No subject)

Behold! The wonders of zylum approach!

zylum:

%credit: zylum
fcn GETANGLE (x1, y1, x2, y2 : real) : real
    var dx, dy, ratio, angle : real
    dx := x2 - x1
    dy := y2 - y1
    if dx not= 0 then
        ratio := dy / dx
    else
        ratio := dy / 0.00000001
    end if
    angle := arctand (abs (ratio))
    if dx < 0 then
        angle := 180 - angle
    end if
    if dy < 0 then
        angle := 360 - angle
    end if
    result angle
end GETANGLE


lol Very Happy
Bored




PostPosted: Sun Mar 20, 2005 7:53 pm   Post subject: (No subject)

thx alot for the help crevetes and for pwned the game is sopposed to take a bit of time and thats why the bases are so hard to destroy
Mr. T




PostPosted: Sun Mar 20, 2005 8:15 pm   Post subject: (No subject)

his name is cervantes
Mr. T




PostPosted: Sun Mar 20, 2005 8:15 pm   Post subject: (No subject)

Bored wrote:
thx alot for the help crevetes...


his name is Cervantes Rolling Eyes
[Gandalf]




PostPosted: Mon Mar 21, 2005 7:39 pm   Post subject: (No subject)

Confused spam? I refreshed a few times, and it didn't go away..?

Cool game btw! Hope to see it in the 'submissions' section soon. Very Happy
amz_best




PostPosted: Sun Oct 19, 2014 5:45 pm   Post subject: RE:Calculate angle between two points

Can you do a tutorial on how to make those bullets, explode?
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: