|
Hi people!
In this new design course we were given a new assignment in the same group we had in the last design course were we had a four week project. In the current design course we were given the assignment of picking another group’s old game that they designed. Our group chose the game Magic Writer which is a typing game where you have to defend yourself against waves of enemies.
My role in the current project is QA, but for the last four weeks my primary job has been coding.
My hardest challenge so far has been creating the animation class. This took me quite a while and I also received quite a bit of help from a group member.
The animation class is basically supposed to change the rectangle from the sprite sheet that the object is setting its texture from, to another rectangle from the same sprite sheet after a set amount of time. 
The making of the hpp file was quite easy, just adding the different functions that I thought we would need and adding logical parameters. The difficult part was the making of the cpp file.
First of all, I had to talk to our lead code quite a lot so I would know how he would like the animation class to be built up, because as you can probably understand, there are more than one way to write the code. There were also some syntax that I needed help with that my group member walked me through so I would understand as deeply as possible.
The way we finally chose to write the code was that we first applied a certain sprite sheet and starting texture rectangle to a object. Then, with the help of the animation class, we change the texture rectangle that the object’s sprite receives from the sprite sheet. For the main characters item spawning animation we had two different textures, so what we did was that every time the player types a letter, the texture changes from one to the other. But for other kinds of animation that are constant and not reliant on player input, for example the moving animation of the enemy, the texture of the monster will change from one to another after a certain amount of time. The way we write down which position of the sprite sheet we want and for how long each animation part shows is by loading in a text file that we read the data from. An example of how we write down data to the text file is by first writing down a name that represents the animation, then a number that represents how many frames that certain animation is, then whether the animation should loop or not, then we write in the duration of the frame and then lastly four values which represents the starting x and y position in the sprite sheet and the width and height of the texture within the sprite sheet.
This is a rough explanation of the animation class that we now have, with some iterations done by my lead code to improve the class.
This class one of few that I have worked on since the start of the project.
That is all for this week, tune in next week for more! Have a nice week!
Ara

About Ara Mohammad
2014 Programming
|