Code Review – Group 15

This is a code review of Group 15’s player class. I will look into how did they implement their player class in their game, what kind of bond to other classes it has and what functions it holds.

To make their player class work they have four keystones:

  • The player class inherits from an Entity class which inherits properties and functions from another class called GameObject. The GameObject class handels most of the games different objects movement, position and when to draw objects in the game.
  • A DrawManager is included which handels the rendering and drawing of the sprites.
  • A SpriteManager is included which handels the different sprite textures.
  • A CollisionManager which handels the player’s collision with other textures.

The functions of the class do not really do much at the moment besides the Update function which handles the player’s movement. The player controls the avatar with WASD and the mouse points out the direction the player is facing and where the player would like to shoot for example.

In GameState the player class position is called upon in order to set the enemies movement towards the player if engaged and if their health is above 0.

Something I do not understand is why the player’s movement controls are created in GameState as well, when they already have one in their Player class. The best solution to this would be to call upon the update function from the player class instead of have multiple functions for player movement. In my opinion it also is more neat to have less code I GameState and much easier to find and modify if needed, if it is placed in the player class.

In the GameState draw function the player calls upon a draw function from the DrawManager to render and draw the player sprites. This is good since it is just one short line of code and does not require anything else. This is how they should have called upon the Update function from the player class in the GameState update function to decrease the amount of code.

The player is also connected with a camera that checks the player’s X and Y position and therefore always focused on the player.

Besides from that one slight flaw with player controls being created twice there is not much that I would like to change. I would like to see them use the player class a bit more though. Maybe put the collision of the player in there as well, just to have easy access to.

But overall it looks good!

About Niclas Nordberg

2015 Programming