Retro_Gameboy
The purpose of this project is to create a GameBoy with classic games.
Arkanoid.h
Go to the documentation of this file.
1 #ifndef ARKANOID_H
2 #define ARKANOID_H
3 
4 #include "GameGenerics.h"
5 
6 class Arkanoid : public GameGenerics
7 {
8 
9  public:
14  Arkanoid();
15 
22  void InitializeVars();
23 
24 
25  private:
26 
30  const int LENGTH = 520;
31 
33  const int WIDTH = 450;
34 
36  const std::string IMAGEPATH = "images/Arkanoid_Img/";
37 
39  int n;
40 
43 
49 
52  bool isGameOver;
53 
55  void PlayArkanoid( RenderWindow& window, Sprite& s_Background, Sprite& s_Ball, Sprite& s_Paddle, Sprite* block, Sprite* lives, Texture& texture1 );
56 
60  void CheckCollisions( float& xAxis, float& xPos, float& yAxis, float& yPos, Sprite* block, const bool isVertical );
61 
65  void SetBoundaries( float& xAxis, float& xPos, float& yAxis, float& yPos, Sprite* lives );
66 
68  void SetControls( Sprite& s_Paddle );
69 
71  void SetLives( Sprite* lives );
72 
75  virtual int CalculateScore();
76 
77 };
78 
79 #endif
int blocksRemain
Remaining titls.
Definition: Arkanoid.h:42
virtual int CalculateScore()
Pure virtual function inherited from GameGenerics.h Each game calculate scores differently and theref...
Definition: Arkanoid.cpp:134
const std::string IMAGEPATH
Define path where image are located.
Definition: Arkanoid.h:36
Arkanoid()
Default Constructor. Calls the InitializeVars() function.
Definition: Arkanoid.cpp:5
const int WIDTH
Define the Width of the window.
Definition: Arkanoid.h:33
int n
The number of tiles in the block. Currently, it has 100 tiles.
Definition: Arkanoid.h:39
void SetBoundaries(float &xAxis, float &xPos, float &yAxis, float &yPos, Sprite *lives)
Set the boundaries so ball will remian inside the window. Also, whenever the ball hits outside the pa...
Definition: Arkanoid.cpp:81
void InitializeVars()
Create Sprites. Load the Images and set the Sprites. Creates a block of titles with 100 tiles....
Definition: Arkanoid.cpp:10
bool isGameOver
Set true when user lost all the chances. This indicate time to display game over screen.
Definition: Arkanoid.h:52
int remainingLives
Player has 3 hearts and once it ran out game will be over. Remaining lives are multiple of 2....
Definition: Arkanoid.h:48
const int LENGTH
Define the length of the window. If you want to change this you might need to change the background i...
Definition: Arkanoid.h:30
void SetControls(Sprite &s_Paddle)
Set the paddle to move right and left by pressing right and left arrow keys.
Definition: Arkanoid.cpp:101
void PlayArkanoid(RenderWindow &window, Sprite &s_Background, Sprite &s_Ball, Sprite &s_Paddle, Sprite *block, Sprite *lives, Texture &texture1)
Start the game and call other helper functions.
Definition: Arkanoid.cpp:164
void CheckCollisions(float &xAxis, float &xPos, float &yAxis, float &yPos, Sprite *block, const bool isVertical)
This will check collisions with the tiles and the ball. Everytime the ball hit a tile,...
Definition: Arkanoid.cpp:59
void SetLives(Sprite *lives)
Remove a heart whenever user miss the ball and it hit outside the paddle.
Definition: Arkanoid.cpp:114