This post is a portion of my mini-series on Object Oriented Game Development using the Allegro 5 library. You can see all of the posts by going to http://fixbyproximity.com and clicking the “OOP Game Development” button at the top of this site.
Full Game Source Here
Videos in the Series:
- Object Oriented Game Development – Intro
- Object Oriented Game Development – Part 1
- Object Oriented Game Development – Part 2
- Object Oriented Game Development – Part 3
- Object Oriented Game Development – Part 4
- Object Oriented Game Development – Part 5
- Object Oriented Game Development – Part 6
- Object Oriented Game Development – Part 7
- Object Oriented Game Development – Part 8
Thank you so much for these tutorials, I have learnt more here about allegro game programming than all the other tutorials combined!
Saying at the end, that some things arn’t done perfectly or maybe ‘the best way to do everything’. What do you feel wasn’t done perfectly? Or what would you do differently given the time?
He may be talking specifically about destroying each bitmap in the main.cpp, as the intent of these videos were to make things object oriented and to teach us a wide spectrum of things. 😛
To everybody having issues compiling the final code: if you’re on a 64bit system there’s a good change that the problem is in the cdecl convention, supported only in 32bit compilers. To solve that simply replace __cdecl with __fastcall .
If you also get many “undefined reference to […]” errors probably you’re not using an IDE that links the source files to each other or you didn’t configure it properly. You can try setting a project in your IDE or manually creating a makefile.
This is the makefile I use:
After like 5 months, finish all Allegro 5 video tutorials 😀 THANKS
ok ok, like 3 months :p
Hey again, Got a few more bugs to fix. My ship isnt loosing lives when it hits the comets, don’t know why but i don’t think it is running the ship->Collided() for some reason. Also another bug, I do the ChangeState(state,LOST); but when 3 comets go past, the game resets the lives to 3 and continues.
Doh! Left the ‘d’ off Collided in the SpaceShip object, one down, one to go.
Sorry noob error, using ‘=’ instead of ‘==’ in ChangeState if(state = PLAYING), now all is well, But…
The explosion animations arent deleting with the comets and bullets so after state changes from ‘LOST’ to ‘PLAYING’ we start off with a bang ;). I changed the explosion code to SetID(ENEMY) and it took care of that.
Thankyou Mike, I have had fun learning with these tutorials and now I have a much better understanding not only of allegro game programming but C++ as well.
Hello! So many thanks for your tutorials. They taught me a lot and you explained everything so well it was very easy to understand it all! (though I wasn’t completely new to OOP or C++, I have a couple months experience)
I have a question. I see that this program when running requires ~75MB of memory. It gets slightly higher once you get for the first time into PLAYING state. Isn’t that a lot for such a simple program or am I underestimating how much memory it could require? If it’s the first case how do you go about fixing it?
I’d also love if you could make a small tutorial sometime about how you’d go about it if your FPS dropped (in say a more complicated game). I imagine some weird things would start happening if your computer could run the game at 30FPS yet its all balanced around 60.
Glad you enjoy! I would love to do more videos but I have a couple other projects going on right now. Maybe when those are finished.
Maybe a allegro rpg engine in c++?
Thank you sooo much for these tutorials, very very helpful!
Coming from a developer who has done nothing but (non game dev) OOP: these videos were a fantastic intro to OOP in general. I’ll be stashing this away as a teaching tool, for later.
It was also really nice to see how a lot of the things that other game engines handle for you are done when you do them from scratch.
Hi Mike. I’ve trying to use animated bullets instead of the primitive circle. I’ve modified the bullet constructor to take in an allegro bitmap image as well as changed the update and render methods for bullet accordingly. However each time I hit the space key I don’t see the bullet getting rendered at all. I do see my enemies getting hit so I know the object is created but I cannot see it. The bullet is only created once the space key is pressed. Is it possible that the program is automatically deleting my bitmap sprites for the bullets after just one key press? Any help would be appreciated as I’m trying to complete a university project.