• Advertisement
Sign in to follow this  

How ti fire multiple times

This topic is 1736 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement

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
Sign in to follow this  

  • Advertisement