Retro_Gameboy
The purpose of this project is to create a GameBoy with classic games.
|
#include <Arkanoid.h>
Public Member Functions | |
Arkanoid () | |
Default Constructor. Calls the InitializeVars() function. More... | |
void | InitializeVars () |
Create Sprites. Load the Images and set the Sprites. Creates a block of titles with 100 tiles. Call PlayArkanoid() function to start the game. More... | |
![]() | |
GameGenerics () | |
Default Constructor for GameGenerics. This is a abstract class and you cannot instantiate this class. More... | |
Private Member Functions | |
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. More... | |
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, this record a collision and hide the tile by throwing it far away from the x axis. The collisions are recorded both x and y axises. More... | |
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 paddel ( yAxis == width ), it will penalized the user by reducing one heart. Call the SetLives() function to remove one heartl. More... | |
void | SetControls (Sprite &s_Paddle) |
Set the paddle to move right and left by pressing right and left arrow keys. More... | |
void | SetLives (Sprite *lives) |
Remove a heart whenever user miss the ball and it hit outside the paddle. More... | |
virtual int | CalculateScore () |
Pure virtual function inherited from GameGenerics.h Each game calculate scores differently and therefore this function need to override in each game according to the game rules. More... | |
Private Attributes | |
const int | LENGTH = 520 |
Define the length of the window. If you want to change this you might need to change the background image too. Current length and width is match the background image. More... | |
const int | WIDTH = 450 |
Define the Width of the window. More... | |
const std::string | IMAGEPATH = "images/Arkanoid_Img/" |
Define path where image are located. More... | |
int | n |
The number of tiles in the block. Currently, it has 100 tiles. More... | |
int | blocksRemain |
Remaining titls. More... | |
int | remainingLives |
Player has 3 hearts and once it ran out game will be over. Remaining lives are multiple of 2. For example, 3 hearts means ( 3 x 2) remainning lives. Remaining lives get calculated in SetBoundaries() function and it get called two times for each calculation. This is why remaining live is a multiple of 2. More... | |
bool | isGameOver |
Set true when user lost all the chances. This indicate time to display game over screen. More... | |
Additional Inherited Members | |
![]() | |
void | GameOverScreen (RenderWindow &window) |
Display a game over screen at the end of the game alone with user's score. Currently, every game has the same game over screen. If each and every game needs a different screen, it might be a good idea to make it a pure virtual function. More... | |
Definition at line 6 of file Arkanoid.h.
Arkanoid::Arkanoid | ( | ) |
Default Constructor. Calls the InitializeVars() function.
Definition at line 5 of file Arkanoid.cpp.
|
privatevirtual |
Pure virtual function inherited from GameGenerics.h Each game calculate scores differently and therefore this function need to override in each game according to the game rules.
Implements GameGenerics.
Definition at line 134 of file Arkanoid.cpp.
|
private |
This will check collisions with the tiles and the ball. Everytime the ball hit a tile, this record a collision and hide the tile by throwing it far away from the x axis. The collisions are recorded both x and y axises.
Definition at line 59 of file Arkanoid.cpp.
void Arkanoid::InitializeVars | ( | ) |
Create Sprites. Load the Images and set the Sprites. Creates a block of titles with 100 tiles. Call PlayArkanoid() function to start the game.
Definition at line 10 of file Arkanoid.cpp.
|
private |
Start the game and call other helper functions.
Definition at line 164 of file Arkanoid.cpp.
|
private |
Set the boundaries so ball will remian inside the window. Also, whenever the ball hits outside the paddel ( yAxis == width ), it will penalized the user by reducing one heart. Call the SetLives() function to remove one heartl.
Definition at line 81 of file Arkanoid.cpp.
|
private |
Set the paddle to move right and left by pressing right and left arrow keys.
Definition at line 101 of file Arkanoid.cpp.
|
private |
Remove a heart whenever user miss the ball and it hit outside the paddle.
Definition at line 114 of file Arkanoid.cpp.
|
private |
Remaining titls.
Definition at line 42 of file Arkanoid.h.
|
private |
Define path where image are located.
Definition at line 36 of file Arkanoid.h.
|
private |
Set true when user lost all the chances. This indicate time to display game over screen.
Definition at line 52 of file Arkanoid.h.
|
private |
Define the length of the window. If you want to change this you might need to change the background image too. Current length and width is match the background image.
Definition at line 30 of file Arkanoid.h.
|
private |
The number of tiles in the block. Currently, it has 100 tiles.
Definition at line 39 of file Arkanoid.h.
|
private |
Player has 3 hearts and once it ran out game will be over. Remaining lives are multiple of 2. For example, 3 hearts means ( 3 x 2) remainning lives. Remaining lives get calculated in SetBoundaries() function and it get called two times for each calculation. This is why remaining live is a multiple of 2.
Definition at line 48 of file Arkanoid.h.
|
private |
Define the Width of the window.
Definition at line 33 of file Arkanoid.h.