Sign in to follow this  
Dhruv Jain

How ti fire multiple times

Recommended Posts

Dhruv Jain    109

I am learning XNA and i just tried to make a game similar to galaga.I have made a ship to fire and i can fire a bullet.The problem is after i fire a bullet and user presses space[fire key] again my bullet disappears and new bullet appears at new location. 

I am attaching the game file below.Please help me

Share this post

Link to post
Share on other sites
L. Spiro    25620

That means you are using a single instance of a bullet instead of creating multiple bullets.


When bullets are fired, add them to a list of bullets held by an array/list/whatever C# calls them (functional equivalent of std::vector).

Update and render all bullets in that list each frame.  Do remember to remove them when they die.



L. Spiro

Edited by L. Spiro

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this