Group 12 code review
|
The player cpp file is dependent on a sprite for the player to be drawn on the screen. It also dependent on two integers called speed x and y this is to simulate acceleration by adding to these. It also requires player direction to see if what direction the player is moving in. The class also has a movement function and within it there is maximum values on the speed variables. This is tom stop the player from going too fast. From det direction and speed they get the rotation and set a maximum speed on that too. This is to stop the player from rotating too fast. What you could have done differently here is instead of having separate function for x and y you could have used a vector2. The class also needs keyboard input to be able to move the player around in the game. Lastly the class have three different functions for losing, adding and getting hp. These functions are used in the gamestate to deal with the health of the player.
When making a player object you have to input a vector2 to set the position of the player. You have to set directions x and y values into the direction functions. and you have to input a sprite and and float called deltaTime. The deltaTime is used to update everything at the same frequency. |