|||

back

August 10th 2024

Implementing the animated sprites scene

Task introduction

The goal of the animated sprite task was to create test animated sprite objects. The base code was provided in the lecture slides which I had implemented into the framework which then allowed me to create and add animated sprites to my scenes.

Purpose

The purpose of this short post is to reflect on the debugging process that I went through to successfully implement animated sprites and a demo scene to show off the implementation.

Bug

Not Displaying Properly During this task I only faced one problem which was similar to a previous one I had of the sprites not displaying properly. Armed with the knowledge I previously gained from the Checkerboard Task, I knew that this bug was related to the vectices of the animated sprite class.

After looking at the indices used for the vertices and comparing them to the lecture slides, it confirmed that the bug was indeed here. Bug Found

I had mistyped { 1 + 1 } instead of { 1 + i}, I was also missing an extra { 2 + i }. This is what the list of indices should have been: Bug Fixed

With this bug crushed I launched the application again and the disfigured sprite was fixed! Bug Fixed Demo

Final touches

With the success of one animated sprite ebing displayed, I refactored the code for demonstration purposes to store multiple pointers to the sprite. The change allowed me to display three of the test animated sprites on screen and using the debugger allowing me to select and scroll through each one. Added extra animated sprites