How ti fire multiple times

Started by
1 comment, last by Dhruv Jain 10 years, 12 months ago

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

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

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

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

This topic is closed to new replies.

Advertisement