Jump to content

  • Log In with Google      Sign In   
  • Create Account

How ti fire multiple times


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 hackarchives   Members   -  Reputation: 109

Like
0Likes
Like

Posted 20 April 2013 - 11:07 PM

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

Attached Files



Sponsor:

#2 L. Spiro   Crossbones+   -  Reputation: 13634

Like
1Likes
Like

Posted 20 April 2013 - 11:36 PM

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, 20 April 2013 - 11:37 PM.

It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#3 hackarchives   Members   -  Reputation: 109

Like
0Likes
Like

Posted 20 April 2013 - 11:44 PM

Thanks..Why the hell i did not think of it that way!!!I will try it and get back to you :)






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS