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

Username:   Password: 
 RegisterRegister   
 How to Shoot...
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
DonQuixote




PostPosted: Wed Jun 16, 2004 7:14 am   Post subject: How to Shoot...

I am trying to make a (semi-) Starcraft game that works perfectly so far. But there's only one problem ... How do I make the spacecrafts shoot in the direction that they are facing??? This plagues up the entire game... when i tried myriad ways, all failed... Plz Help!
THANX A LOT!!!
Sponsor
Sponsor
Sponsor
sponsor
SuperGenius




PostPosted: Wed Jun 16, 2004 9:50 am   Post subject: (No subject)

It depends on the viewpoint. I assuume you used an isomatric setup like in starcraft?
AsianSensation




PostPosted: Wed Jun 16, 2004 11:06 am   Post subject: (No subject)

well, if you know what angle they are facing, then shooting is easy.

instead of normal bullets that goes straight up like this:

code:
loop
    y += 5
    drawfilloval (x, y, 5, 5, red)
    cls
end loop


do something like this:

code:
loop
    y += sind (angle)
    x += cosd (angle)
    drawfilloval (x, y, 5, 5, red)
    cls
end loop


where the variable angle is the angle they are facing.
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  [ 3 Posts ]
Jump to:   


Style:  
Search: