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
Quick question about this part of the tutorial:
Why is the frequency of generating comets set to rand() % 100 instead of rand() % 500 like it was in the non-OO version of the game? Also, when I did this [art of the tutorial, my comets seem to come at a much lower rate than yours do and a lower rate than in my non-OO version as well. Any ideas why this might be?
Ok I have another question about this part. Another thing I have noticed is that the comets seem to flicker occasionally while they are going. Do you know why they would be doing this?
Great tutorial. I have one question. In part 5, 21:20 How you manage to bypass initialization in case label error. I mean normaly you can’t put initialization in case labal at least it’s not working for me. I have to put extra brackets in case label to makes it work. It’s compiler dependent?
I had the same problem as Zach with the comet flickering. Had to change a the line in Comet::Update() to this :-
else if(curFrame <= 0)
curFrame = maxFrame – 1;//had to add the -1
Hope this helps.
On exiting the game i sometimes (not everytime) get this error:-
Unhandled exception at 0x5724c975 in ALLEGRO CPP.exe: 0xC0000005: Access violation reading location 0xfeef001a.
It and this seems to happen on the line
delete(*iter);
Any suggestions welcome – cheers
The fix to this error is covered in part 6
Thank You man, You’ve just saved me from searching throughout all the code I’ve wrote 🙂 Cheers!