Jump to content

View more

Image of the Day

WIP title screen for #DeathOfAPartisan #screenshotsaturday #gamedev https://t.co/qJNhfZCvd4
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

How ti fire multiple times

4: Adsense

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   

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



#2 L. Spiro   Members   

25466
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.


#3 hackarchives   Members   

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.