SFML community forums

General => SFML projects => Topic started by: e_barroga on September 10, 2009, 02:40:29 am

Title: 2D Shooter
Post by: e_barroga on September 10, 2009, 02:40:29 am
This is basically a SHMUP game.

Finished all the main mechanics of the game engine. All that I have left to do is the gameplay and graphics. Right now I am looking for an artist.

Here's a bin:

Here's the source:

I post the source because I'd like for people to mention suggestions on ways I could improve the coding.

For testing purposes, 1, 2, 3, 4 change the level of the base gun.

The base gun is supposed to upgrade through your score. There will be powerups and pickups that give you additional guns and boosters for faster movement.
Title: 2D Shooter
Post by: LGV on September 10, 2009, 04:37:06 am
Nice work man!!  :). Right now I'm looking a bit the source code (you used globals in Engine, you must dieeeeee!!!  :lol:), the design seems nice to me, tough my engine it's far very diferent and uncomplete, I think yours is better  :). I saw that the demo doesn't have any animations (I am correct?), do you will implement it in the final version?.
A simple suggestion: I saw an ugly thing, the half of the ship was outside of the screen when I move right/left/up/down, so I decide to hack a little bit your EntityPlayer.cpp and fix it, I just modify a few lines of code:
Code: [Select]

78: if (GetPosition().x > GetSize().x / 2)
84: if (GetPosition().x < GetEngine().GetRenderWindow().GetWidth() - (GetSize().x / 2))
90: if (GetPosition().y > GetSize().y / 2)
98: if (GetPosition().y < GetEngine().GetRenderWindow().GetHeight() - (GetSize().y / 2))

I hope it helps. Keep up the hard work!!  8)
Title: 2D Shooter
Post by: e_barroga on September 10, 2009, 02:18:07 pm
Thank you for the suggestion. I've actually noticed that before and have been meaning to fix it but I guess I forgot.

I use:
Code: [Select]


The globals: score, baseGun, massiveDeath, loseCount

are actually a quick hack of mine because I couldn't decide on the most elegant way to access them from all entities.

I do not have anything to handle animations because I haven't the need for them yet.... however, if I ever do I have a good idea how to implement.
Title: 2D Shooter
Post by: LGV on September 10, 2009, 05:41:11 pm
The way I implemented the animations it's quite easy and straightforward: I did a class that can handle tilesets, that way, you specify the Height and Width of a tile (this maybe can be a limitation, the tiles of the tileset must be the same size, but for now is sufficient :P), and the number of Columns and Rows of the tileset. Then, I do something like this to define an animation:
Code: [Select]

// 0,1,2,3 are the frames of the animation
sprite.setAnimation("0,1,2,3", "default");

// tons of useful code...

// play the animation

I have no troubles to give you the sources if you want it.
For the globals, I think a nice way will be have a struct "Globals" with all the data you need, and then just add two functions to Engine, "getGlobals()" and "setGlobals()", I think it's a little more elegant than just using quick & dirty globals.