most efficient way to implement bullets

Understanding the language, error messages, etc.

most efficient way to implement bullets

Postby noah » Thu Oct 13, 2016 6:37 am

Hi,
I was trying to add bullets to the game I'm working on, but came across a couple of problems. Firstly, I am probably going to need a function updateBullets() so that the game can continue while bullets are moving, etc. Also, I only want a maximum of three bullets allowed at a time. I am not sure how to implement these things. I was thinking possibly with an array that stores the bullet x and another for the y, and then changes the amount on each call of updateBullets() but I'm not sure. Any ideas?

Thanks in advance, Noah :)
User avatar
noah
 
Posts: 25
Joined: Mon Jul 25, 2016 8:32 am
Location: Spiffin' Britain

Re: most efficient way to implement bullets

Postby Sorunome » Thu Oct 13, 2016 2:54 pm

Yeah, the basic idea is to make an array of bullets, you make a class Bullet with the data for the positions and then methods like updating etc. and then loop through said array each frame and update all the bullets.
User avatar
Sorunome
 
Posts: 629
Joined: Sun Mar 01, 2015 1:58 pm


Return to Programming Questions

Who is online

Users browsing this forum: No registered users and 6 guests