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

## Recommended Posts

Hi all I am wondering if there are some decent tutorials for making an arcade shooter like 1942, which happens to be the type of game I am currently working on. Thanks

##### Share on other sites
If you use a tutorial to make an arcade shooter like that, it won't be your game, it would be the author of the tutorials. If you make the game by yourself without a direct tutorial about it, it will be your game. Try it yourself and see how far you get. SpriteLib has some nice graphics for an arcade shooter.

##### Share on other sites
Well, I guess tutorial is not exactly what I meant. What I am really looking for is a code snippet on how draw a bullet when the player hits a key.

I have some of this coded so far, the only problem is that when the users fires his bullet and then moves the ship, the bullet mirrors the movement of the player.

I was thinking of making the bullet a class, so that I can use it for both player and enemy bullets and creating a function within the class to get the player's current x,y position so that I can draw the bullet beginning at that posistion.

SpriteLib is a great library and would be nice to find some others like it.

##### Share on other sites
Sounds like you have the bullet tied to the player's position somehow even after it is fired.

Creating a bullet class is a great idea. This way you can create a list or array (The STL is your best friend here, list and vector work great) to manage all of your bullets kind of like a particle system.

When firing you should set a bullet's initial x,y position and x,y velocities with all future updates based on the previous update. This way you set the initial values and it acts independantly of other game objects.

something like:
// when a user fires a bullet// create a bullet objectCBullet bullet;// initialize itbullet.Initialize( player_x, player_y, speed_x, speed_y );// add it to a list of bulletsbullet_list.push_back(bullet);// then after it has been fired go through the list of bullets// and for each bullet do something likebullet.Update( time_passed );// where the bullets update function looks something like this// where time is in milliseconds where 1 ms = 0.001// and speed is in pixels per secondbullet.pos_x += bullet.speed_x*time_passed;bullet.pos_y += bullet.speed_y*time_passed;

There would also be collision detection and stuff as well, but this should help get you started.

I hope that helps

##### Share on other sites
Thanks for the code snippet. It will certainly come in handy I am sure

##### Share on other sites
For some reason I can't find this anymore, but the third STL article I wrote was a demo shooter with the basic gameplay implemented using C++ (duh; STL [smile]) and Allegro, and was specifically designed to be extendable to create different enemies, weapons, etc. I can't find the online version (Pixelate went bye-bye a while ago) and I'm not sure I still have the backup of the offline version. Any old Pixelate readers still have it? It's a good jumping off point for making a shooter IMHO; might help the OP out ...

1. 1
2. 2
3. 3
Rutin
24
4. 4
JoeJ
18
5. 5

• 14
• 23
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631766
• Total Posts
3002232
×