Blogpost no. 1: Spaceshooter

Hi all!

This is the first blogpost since we started this new project I am going to explain real quick what the project is about.
We are pretty much the same group that we worked in during the last project, when we were supposed to create a spaceshooter-concept. In this project we were supposed to pick a spaceshooter-concept that another group made and then create the game based on that concept.

We picked a game called Fancy Mansion which is a game where you are playing a thief inside a fancy mansion and the goal is to steal a lot of the valueable items inside of it.

One of the artifacts I have been working on this week is the walls-class. Since we have multiple different kinds of walls (read: multiple different colours on the walls) we decided to create a class for them instead of just create it hard-coded in the state where walls will be, which is called PlayState.
All walls will behave the same; just stand still and have collision against everything. If we did not create a class for them we would have to write the code multiple times in PlayState with pointers to each sprite. It would take more memory and power from the computer and make the game slower.

I started of by creating the walls in the PlayState-class. We started to  write the same code multiple times which is just plain stupid. It was here we decided to create the wall-class and it was enough with a few lines of code to get the same result. But the result was faster and we got a nicer code structure. A nice code structure is almost one of the most important features when writing software, because if something goes wrong it is extremely hard to debug if the code is unreadable.

The wall-class was not especially hard to make, but it made difference in the development of the game. After that we could just call the class in our PlayState-class and in our map-textfile we could write the number of the entity that was the specific wall we wanted.

In the picture below I will show you the collision that was created, and it is the same collision against every wall even though I am only showing you one example of the collision. You can see the collision since the old man on the left side is wanting to catch the guy to the right.

nannana blogginläggcollision

 

Until next time: Have a good one!

/ Alex

About Alex Henningsson

2014  Programming