Sign in to follow this  

Arcade Shooter Tutorial

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 this post

Link to post
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 this post

Link to post
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.

Thanks for the quick reply

Share this post

Link to post
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 object
CBullet bullet;
// initialize it
bullet.Initialize( player_x, player_y, speed_x, speed_y );
// add it to a list of bullets

// then after it has been fired go through the list of bullets
// and for each bullet do something like
bullet.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 second
bullet.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 this post

Link to post
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 ...

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this