Switch to full style
Understanding the language, error messages, etc.
Post a reply

most efficient way to implement bullets

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 :)

Re: most efficient way to implement bullets

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.
Post a reply