-
Notifications
You must be signed in to change notification settings - Fork 0
Class Instance
Alex Ricciardi edited this page Apr 6, 2023
·
2 revisions
/*
Parent class to the Level class
Renders ball, paddle, and FPS
*/
//----------------------------------------------------------------------------------
//----------------------------------------------------------------------------------
// variables (Private)
//----------------------------------------------------------------------------------
// Screen
int screen_width = GetScreenWidth();
int screen_height = GetScreenHeight();
// Instances
bool game_is_paused = false;
// Ball
bool new_ball = true;
unsigned ball_direction_rand = 0;
/----------------------------------------------------------------------------------
//----------------------------------------------------------------------------------
// variables (Public)
//----------------------------------------------------------------------------------
bool instanceIsLivelive = true;
int collisionResult = 0;
// Ball
Ball ball;
// Paddle
Paddle paddle;
// Sound
Sound soundBall = LoadSound("resources/sounds/ball_collision.wav");
bool isSound = true;
// Aiming line
DottedLine aimingLine;
/*---------------------------------------------------
Default constructor
----------------------------------------------------*/
Instance();
//----------------------------------------------------------------------------------
//----------------------------------------------------------------------------------
// Accessors Methods
//----------------------------------------------------------------------------------
Ball getBall();
/*----------------------------------------------------
Render the Instance class
Not inherited by child classes
-----------------------------------------------------*/
virtual void render();
//----------------------------------------------------------------------------------
//----------------------------------------------------------------------------------
// Mutators Methods
//---------------------------------------------------------------------------------
/*---------------------------------------------------
Updates ball, paddle, bricks position positions,
and key strocks
Not inherited by child classes
----------------------------------------------------*/
void updateInst();
/*---------------------------------------------------
Draws a doted line
----------------------------------------------------*/
void drawDottedLine(int start_pos_x, int start_pos_y, int end_pos_x, int end_pos_y, int num_points);
private:
//----------------------------------------------------------------------------------
//----------------------------------------------------------------------------------
// Classe Operation Methods (private)
//---------------------------------------------------------------------------------
/*---------------------------------------------------
Display Ball, paddle, bricks
Not inherited by child classes
----------------------------------------------------*/
virtual void draw();
/*----------------------------------------------------
Pauses the screen, the game
Utilized by updateInst()
-----------------------------------------------------*/
void pauseScreen(int pauseKey);
/*------------------------------------------------------
Checks if paddle has collide with the screen sides
and readjust paddle position
Utilized by update_instance()
-------------------------------------------------------*/
void paddleCollisionSideScreen();
/*------------------------------------------------------
Checks ball collisions
Utilized by update_inst()
-------------------------------------------------------*/
int ballCollisions();
/*------------------------------------------------------
Checks pressed keys
window state, closed, escape key pressed
and adjust the paddle position
Utilized by update_inst()
-------------------------------------------------------*/
void keyStrocks();
/*------------------------------------------------------
Aiming and Launching the ball
-------------------------------------------------------*/
void launchBall();
