This commit is contained in:
RafayAhmad7548 2024-06-16 18:53:25 +05:00
parent 37776af5db
commit ab03d5f10c
4045 changed files with 286212 additions and 3 deletions

View file

@ -0,0 +1,51 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}

View file

@ -0,0 +1,54 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = rand()%1040;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY){
// color = new float[3];
color = other.color;
}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}

View file

@ -0,0 +1,80 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
bool Ball::checkBoundCollision(int& lives, int currentLevel){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y - radius <= 0){
lives--;
return true;
}
if(currentLevel == 3){
if(y + radius >= 840){
lives--;
return true;
}
}
else if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
return false;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,64 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,80 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(int& lives, int currentLevel){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y - radius <= 0){
lives--;
x = 500;
y = 200;
if(lives<=0){
exit(0);
}
}
if(currentLevel == 3){
}
else if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,55 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
// Ball::~Ball(){
// delete color;
// }

View file

@ -0,0 +1,67 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float* color){
this->color = color;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,46 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : x(x), y(y), radius(radius), color(color), vX(5), vY(5){}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY){
// color = new float[3];
color = other.color;
}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}

View file

@ -0,0 +1,89 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(int& lives, int currentLevel){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y - radius <= 0){
lives--;
x = 500;
y = 200;
if(lives<=0){
exit(0);
}
}
if(currentLevel == 3){
if(y + radius >= 840){
lives--;
x = 500;
y = 200;
vX = 5;
vY = 5;
if(lives<=0){
exit(0);
}
}
}
else if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,69 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
if(y - radius <= 0) vY = 5;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,70 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
if(y - radius <= 0) vY = 5;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,90 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(int& lives, int currentLevel){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y - radius <= 0){
lives--;
x = 500;
y = 200;
if(lives<=0){
exit(0);
}
}
if(currentLevel == 3){
if(y + radius >= 840){
lives--;
x = 500;
y = 200;
vX = 5;
vY = 5;
if(lives<=0){
exit(0);
}
}
}
else if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,74 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(int& lives, int currentLevel){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y - radius <= 0){
lives--;
x = 500;
y = 200;
}
if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,87 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(int& lives, int currentLevel){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y - radius <= 0){
lives--;
x = 500;
y = 200;
if(lives<=0){
exit(0);
}
}
if(currentLevel == 3){
if(y + radius >= 840){
lives--;
x = 500;
y = 200;
if(lives<=0){
exit(0);
}
}
}
else if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,79 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(int& lives, int currentLevel){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y - radius <= 0){
lives--;
delete this;
}
if(currentLevel == 3){
if(y + radius >= 840){
lives--;
delete this;
}
}
else if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,47 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : x(x == -10 ? rand()%1050 : x), y(y), radius(radius), color(color), vX(5), vY(5){
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY){
// color = new float[3];
color = other.color;
}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}

View file

@ -0,0 +1,47 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY){
// color = new float[3];
color = other.color;
}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}

View file

@ -0,0 +1,48 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : x(x), y(y), radius(radius), color(color), vX(5), vY(5){
if(x == -1) x = rand()%1050;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY){
// color = new float[3];
color = other.color;
}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}

View file

@ -0,0 +1,77 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(int& lives, int currentLevel){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y - radius <= 0){
lives--;
x = 500;
y = 200;
if(lives<=0){
exit(0);
}
}
if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,48 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : x(x), y(y), radius(radius), color(color), vX(5), vY(5){
if(x == -10) x = rand()%1050;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY){
// color = new float[3];
color = other.color;
}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}

View file

@ -0,0 +1,51 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = rand()%1040;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}

View file

@ -0,0 +1,56 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,55 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){
// delete color;
}

View file

@ -0,0 +1,77 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
bool Ball::checkBoundCollision(int currentLevel){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y - radius <= 0){
return true;
}
if(currentLevel == 3){
if(y + radius >= 840){
return true;
}
}
else if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
return false;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,71 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
bool Ball::checkBoundCollision(int currentLevel){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y - radius <= 0) return true;
if(currentLevel == 3 && y + radius >= 840) return true;
else if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
return false;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,54 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = rand()%1040;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY){
// color = new float[3];
color = other.color;
}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}

View file

@ -0,0 +1,46 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : x(x), y(y), radius(radius), color(color), vX(5), vY(5){}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY){
// color = new float[3];
color = other.color;
}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1020) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}

View file

@ -0,0 +1,54 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = rand()%1050;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY){
// color = new float[3];
color = other.color;
}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}

View file

@ -0,0 +1,77 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(int& lives, int currentLevel){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y - radius <= 0){
lives--;
x = 500;
y = 200;
if(lives<=0){
}
}
if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,46 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : x(x), y(y), radius(radius), color(color), vX(5), vY(5){}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY){
// color = new float[3];
color = other.color;
}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 10 || x + radius >= 1010) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}

View file

@ -0,0 +1,53 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1 @@
{"version":1,"resource":"file:///home/rafayahmad/Stuff/OOP/Project/Ball.cpp","entries":[{"id":"bUjV.cpp","timestamp":1714539882160},{"id":"YpdW.cpp","timestamp":1714540634452},{"id":"Ai06.cpp","timestamp":1714616105926},{"id":"ti49.cpp","timestamp":1714616604296},{"id":"NjIm.cpp","timestamp":1714616635779},{"id":"OMJk.cpp","timestamp":1714616674448},{"id":"Ib65.cpp","timestamp":1714616724158},{"id":"Mqb7.cpp","timestamp":1714616991697},{"id":"lcUV.cpp","timestamp":1714617019437},{"id":"b4FR.cpp","timestamp":1714617154060},{"id":"1y4z.cpp","timestamp":1714617211340},{"id":"Ws5V.cpp","timestamp":1714617231477},{"id":"RHzO.cpp","timestamp":1714617298113},{"id":"uQqz.cpp","timestamp":1714654497717},{"id":"1G3L.cpp","timestamp":1714655055580},{"id":"hrRI.cpp","timestamp":1714700154412},{"id":"5QXt.cpp","timestamp":1714700281595},{"id":"TqTd.cpp","timestamp":1714700378383},{"id":"dWMG.cpp","timestamp":1714700655861},{"id":"SEZb.cpp","timestamp":1715094136194},{"id":"36sk.cpp","timestamp":1715138854983},{"id":"5pyt.cpp","timestamp":1715145533257},{"id":"gjHn.cpp","timestamp":1715145563340},{"id":"l38H.cpp","timestamp":1715179072063},{"id":"yClm.cpp","timestamp":1715179214919},{"id":"CWt5.cpp","timestamp":1715179273348},{"id":"oX90.cpp","timestamp":1715179709616},{"id":"Fmaa.cpp","timestamp":1715179758277},{"id":"xoEB.cpp","timestamp":1715179776301},{"id":"pg3Y.cpp","timestamp":1715179802638},{"id":"ysEt.cpp","timestamp":1715179897643},{"id":"iZmX.cpp","timestamp":1715179990192},{"id":"wSVi.cpp","timestamp":1715180016147},{"id":"HBpZ.cpp","timestamp":1715180036086},{"id":"b7ZI.cpp","timestamp":1715180064385},{"id":"O5Vy.cpp","timestamp":1715180091337},{"id":"5Lqw.cpp","timestamp":1715180111601},{"id":"Hcee.cpp","timestamp":1715180132005},{"id":"j98V.cpp","timestamp":1715180242789},{"id":"GmG8.cpp","timestamp":1715180287621},{"id":"BfFo.cpp","timestamp":1715180297687},{"id":"jvXm.cpp","timestamp":1715180462453},{"id":"Hvr4.cpp","timestamp":1715180483581},{"id":"pPrP.cpp","timestamp":1715180555243},{"id":"2Axo.cpp","timestamp":1715180571126},{"id":"ue5T.cpp","timestamp":1715180724206},{"id":"TviH.cpp","timestamp":1715180749070},{"id":"nMvj.cpp","timestamp":1715180999138},{"id":"WCzC.cpp","timestamp":1715181016407},{"id":"wpm9.cpp","timestamp":1715181034317}]}

View file

@ -0,0 +1,68 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,55 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){
delete color;
}

View file

@ -0,0 +1,70 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(int& lives, int currentLevel){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
if(y - radius <= 0) vY = vY<0 ? vY*-1 : vY;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,89 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(int& lives, int currentLevel){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y - radius <= 0){
lives--;
x = 500;
y = 200;
if(lives<=0){
exit(0);
}
}
if(currentLevel == 3){
if(y + radius >= 840){
lives--;
x = 500;
y = 200;
vX = 5;
vY = 5;
if(lives<=0){
exit(0);
}
}
}
else if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,83 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(int& lives, int currentLevel){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y - radius <= 0){
lives--;
x = 500;
y = 200;
if(lives<=0){
exit(0);
}
}
if(currentLevel == 3){
if(y + radius >= 840){
lives--;
delete this;
}
}
else if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,68 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840 || y - radius <= 0) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,49 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
if(x == -10) this->x = rand()%1050;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY){
// color = new float[3];
color = other.color;
}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}

View file

@ -0,0 +1,75 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
bool Ball::checkBoundCollision(int currentLevel){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y - radius <= 0) return true;
if(currentLevel == 3){
if(y + radius >= 840){
return true;
}
}
else if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
return false;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,70 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY = -5;
if(y - radius <= 0) vY = 5;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,80 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(int& lives, int currentLevel){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y - radius <= 0){
lives--;
return true;
}
if(currentLevel == 3){
if(y + radius >= 840){
lives--;
return true;
}
}
else if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
return false;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,70 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(int& lives){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
if(y - radius <= 0) vY = vY<0 ? vY*-1 : vY;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,46 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : x(rand()%1050), y(y), radius(radius), color(color), vX(5), vY(5){}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY){
// color = new float[3];
color = other.color;
}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}

View file

@ -0,0 +1,51 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = rand()%104 * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}

View file

@ -0,0 +1,77 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
bool Ball::checkBoundCollision(int& lives, int currentLevel){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y - radius <= 0){
return true;
}
if(currentLevel == 3){
if(y + radius >= 840){
return true;
}
}
else if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
return false;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,73 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(int& lives, int currentLevel){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y - radius <= 0){
lives--;
}
if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,71 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
bool Ball::checkBoundCollision(int currentLevel){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y - radius <= 0) return true;
if(currentLevel == 3 && y + radius >= 840) return true;
else if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
return false;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,70 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
if(y - radius <= 0) vY = vY<0 ? vY*-1 : vY;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,69 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY *= -1;
if(y - radius <= 0) vY = -1;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}

View file

@ -0,0 +1,70 @@
#include "Ball.h"
#include "util.h"
Ball::Ball(int x, int y, int radius, float *color) : y(y), radius(radius), color(color), vX(5), vY(5){
static bool seeded = false;
if(!seeded){
srand(time(0));
seeded = true;
}
if(x == -10) this->x = (rand()%104 + 1) * 10;
else this->x = x;
}
Ball::Ball(const Ball& other) : x(other.x), y(other.y), radius(other.radius), vX(other.vX), vY(other.vY), color(other.color){}
void Ball::draw(){
DrawCircle(x, y, radius, color);
}
void Ball::move(){
x += vX;
y += vY;
}
void Ball::checkBoundCollision(int& lives, int currentLevel){
if(x - radius <= 0 || x + radius >= 1050) vX *= -1;
if(y + radius >= 840) vY = vY<0 ? vY : vY*-1;
if(y - radius <= 0) vY = vY<0 ? vY*-1 : vY;
}
int Ball::getRadius(){
return radius;
}
int Ball::getX(){
return x;
}
int Ball::getY(){
return y;
}
int Ball::getVX(){
return vX;
}
int Ball::getVY(){
return vY;
}
float* Ball::getColor(){
return color;
}
Ball& Ball::setColor(float *color){
this->color = color;
return *this;
}
Ball& Ball::setX(int x){
this->x = x;
return *this;
}
Ball& Ball::setY(int y){
this->y = y;
return *this;
}
Ball& Ball::setVX(int vX){
this->vX = vX;
return *this;
}
Ball& Ball::setVY(int vY){
this->vY = vY;
return *this;
}
Ball::~Ball(){}