This post is a portion of Part 8 in my on going series about 2D Game Development using the Allegro 5 library. These posts are in course order. You can see all of the posts in this course by clicking the “2D Game Development” button at the top of this site.
- 8.0 – Structured Sprites
- 8.1 – Our Sprite Struct
- 8.2 – Sprite Struct Demo
- 8.3 – Sprite Struct Gravity Demo
This first video of Part 8. In this video we take a look at the code involved in created a struct for maintaining our sprites. Normally this would be done with a class, but to keep things simple I have written the code to utilize structs instead.
Full source can be found here.
You’re brilliant ! I love your videos. There is so much knowledge in them. Thank You for every minute spent on doing this. After watching some videos I start to undestand true power and potential of this library! Thank You.
Really nice job. Made a lot of things clearer for me, concerning both c++ and allegro.
Thank you again! Man I can’t believe how fast I’m picking this programming up, I really appreciate your efforts.
Hi Mike, thank you verry much for your great work!
I have found a problem:
if(++dragon.frameCount >= dragon.frameDelay)
{
dragon.curFrame += dragon.animationDirection;
if(dragon.curFrame >= dragon.maxFrame)
dragon.curFrame = 0;
// in this line
else if(dragon.curFrame <= 0) // should just be < 0
// because frame 0 will never be shown when dragon backward moved
dragon.curFrame = dragon.maxFrame – 1;
dragon.frameCount = 0;
}
is that right?
or was that intentional?