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

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




PostPosted: Sat Apr 26, 2008 11:53 am   Post subject: shooting

What is the format for making something shoot bullets?
How would I use arrays for this one (if I do need to use them)
It would be nice to if someone could give me the layout of the program that would for example make a box shoot little dots.
Sponsor
Sponsor
Sponsor
sponsor
Sean




PostPosted: Sat Apr 26, 2008 11:55 am   Post subject: RE:shooting

Pretty simple, you draw your gun and then use a for loop to move the bullet in a certain direction.
metachief




PostPosted: Sat Apr 26, 2008 5:09 pm   Post subject: RE:shooting

i mean multiple bullets..how do yoiu make many bullets shoot
Sean




PostPosted: Sat Apr 26, 2008 5:26 pm   Post subject: RE:shooting

Draw numerous bullets, or continuous dots coming from it.
CodeMonkey2000




PostPosted: Sat Apr 26, 2008 9:46 pm   Post subject: Re: RE:shooting

Sean @ Sat Apr 26, 2008 11:55 am wrote:
Pretty simple, you draw your gun and then use a for loop to move the bullet in a certain direction.

No no no, do not use a for loop. Instead remember the bullet's angle and velocity. Using basic trig you make the bullet travel in that angle at that velocity each frame. For efficiency have velX and velY (x and y components of the velocity in relation to the angle) precomputed and just add this to you x and y coordinates. Having types will be useful. Make a type called bullet. It should store the x and ycoordinate and the xVel and yVel. Then you can make a flexible array of bullets.
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  [ 5 Posts ]
Jump to:   


Style:  
Search: