test
This commit is contained in:
parent
37776af5db
commit
ab03d5f10c
4045 changed files with 286212 additions and 3 deletions
51
.config/Code/User/History/6e98a3a3/1G3L.cpp
Normal file
51
.config/Code/User/History/6e98a3a3/1G3L.cpp
Normal 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;
|
||||
}
|
54
.config/Code/User/History/6e98a3a3/1y4z.cpp
Normal file
54
.config/Code/User/History/6e98a3a3/1y4z.cpp
Normal 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;
|
||||
}
|
80
.config/Code/User/History/6e98a3a3/2Axo.cpp
Normal file
80
.config/Code/User/History/6e98a3a3/2Axo.cpp
Normal 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(){}
|
64
.config/Code/User/History/6e98a3a3/36sk.cpp
Normal file
64
.config/Code/User/History/6e98a3a3/36sk.cpp
Normal 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(){}
|
80
.config/Code/User/History/6e98a3a3/5Lqw.cpp
Normal file
80
.config/Code/User/History/6e98a3a3/5Lqw.cpp
Normal 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(){}
|
55
.config/Code/User/History/6e98a3a3/5QXt.cpp
Normal file
55
.config/Code/User/History/6e98a3a3/5QXt.cpp
Normal 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;
|
||||
// }
|
67
.config/Code/User/History/6e98a3a3/5pyt.cpp
Normal file
67
.config/Code/User/History/6e98a3a3/5pyt.cpp
Normal 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(){}
|
46
.config/Code/User/History/6e98a3a3/Ai06.cpp
Normal file
46
.config/Code/User/History/6e98a3a3/Ai06.cpp
Normal 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;
|
||||
}
|
89
.config/Code/User/History/6e98a3a3/BfFo.cpp
Normal file
89
.config/Code/User/History/6e98a3a3/BfFo.cpp
Normal 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(){}
|
69
.config/Code/User/History/6e98a3a3/CWt5.cpp
Normal file
69
.config/Code/User/History/6e98a3a3/CWt5.cpp
Normal 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(){}
|
70
.config/Code/User/History/6e98a3a3/Fmaa.cpp
Normal file
70
.config/Code/User/History/6e98a3a3/Fmaa.cpp
Normal 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(){}
|
90
.config/Code/User/History/6e98a3a3/GmG8.cpp
Normal file
90
.config/Code/User/History/6e98a3a3/GmG8.cpp
Normal 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(){}
|
74
.config/Code/User/History/6e98a3a3/HBpZ.cpp
Normal file
74
.config/Code/User/History/6e98a3a3/HBpZ.cpp
Normal 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(){}
|
87
.config/Code/User/History/6e98a3a3/Hcee.cpp
Normal file
87
.config/Code/User/History/6e98a3a3/Hcee.cpp
Normal 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(){}
|
79
.config/Code/User/History/6e98a3a3/Hvr4.cpp
Normal file
79
.config/Code/User/History/6e98a3a3/Hvr4.cpp
Normal 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(){}
|
47
.config/Code/User/History/6e98a3a3/Ib65.cpp
Normal file
47
.config/Code/User/History/6e98a3a3/Ib65.cpp
Normal 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;
|
||||
}
|
47
.config/Code/User/History/6e98a3a3/Mqb7.cpp
Normal file
47
.config/Code/User/History/6e98a3a3/Mqb7.cpp
Normal 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;
|
||||
}
|
48
.config/Code/User/History/6e98a3a3/NjIm.cpp
Normal file
48
.config/Code/User/History/6e98a3a3/NjIm.cpp
Normal 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;
|
||||
}
|
77
.config/Code/User/History/6e98a3a3/O5Vy.cpp
Normal file
77
.config/Code/User/History/6e98a3a3/O5Vy.cpp
Normal 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(){}
|
48
.config/Code/User/History/6e98a3a3/OMJk.cpp
Normal file
48
.config/Code/User/History/6e98a3a3/OMJk.cpp
Normal 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;
|
||||
}
|
51
.config/Code/User/History/6e98a3a3/RHzO.cpp
Normal file
51
.config/Code/User/History/6e98a3a3/RHzO.cpp
Normal 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;
|
||||
}
|
56
.config/Code/User/History/6e98a3a3/SEZb.cpp
Normal file
56
.config/Code/User/History/6e98a3a3/SEZb.cpp
Normal 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(){}
|
55
.config/Code/User/History/6e98a3a3/TqTd.cpp
Normal file
55
.config/Code/User/History/6e98a3a3/TqTd.cpp
Normal 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;
|
||||
}
|
77
.config/Code/User/History/6e98a3a3/TviH.cpp
Normal file
77
.config/Code/User/History/6e98a3a3/TviH.cpp
Normal 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(){}
|
71
.config/Code/User/History/6e98a3a3/WCzC.cpp
Normal file
71
.config/Code/User/History/6e98a3a3/WCzC.cpp
Normal 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(){}
|
54
.config/Code/User/History/6e98a3a3/Ws5V.cpp
Normal file
54
.config/Code/User/History/6e98a3a3/Ws5V.cpp
Normal 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;
|
||||
}
|
46
.config/Code/User/History/6e98a3a3/YpdW.cpp
Normal file
46
.config/Code/User/History/6e98a3a3/YpdW.cpp
Normal 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;
|
||||
}
|
54
.config/Code/User/History/6e98a3a3/b4FR.cpp
Normal file
54
.config/Code/User/History/6e98a3a3/b4FR.cpp
Normal 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;
|
||||
}
|
77
.config/Code/User/History/6e98a3a3/b7ZI.cpp
Normal file
77
.config/Code/User/History/6e98a3a3/b7ZI.cpp
Normal 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(){}
|
46
.config/Code/User/History/6e98a3a3/bUjV.cpp
Normal file
46
.config/Code/User/History/6e98a3a3/bUjV.cpp
Normal 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;
|
||||
}
|
53
.config/Code/User/History/6e98a3a3/dWMG.cpp
Normal file
53
.config/Code/User/History/6e98a3a3/dWMG.cpp
Normal 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(){}
|
1
.config/Code/User/History/6e98a3a3/entries.json
Normal file
1
.config/Code/User/History/6e98a3a3/entries.json
Normal 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}]}
|
68
.config/Code/User/History/6e98a3a3/gjHn.cpp
Normal file
68
.config/Code/User/History/6e98a3a3/gjHn.cpp
Normal 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(){}
|
55
.config/Code/User/History/6e98a3a3/hrRI.cpp
Normal file
55
.config/Code/User/History/6e98a3a3/hrRI.cpp
Normal 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;
|
||||
}
|
70
.config/Code/User/History/6e98a3a3/iZmX.cpp
Normal file
70
.config/Code/User/History/6e98a3a3/iZmX.cpp
Normal 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(){}
|
89
.config/Code/User/History/6e98a3a3/j98V.cpp
Normal file
89
.config/Code/User/History/6e98a3a3/j98V.cpp
Normal 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(){}
|
83
.config/Code/User/History/6e98a3a3/jvXm.cpp
Normal file
83
.config/Code/User/History/6e98a3a3/jvXm.cpp
Normal 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(){}
|
68
.config/Code/User/History/6e98a3a3/l38H.cpp
Normal file
68
.config/Code/User/History/6e98a3a3/l38H.cpp
Normal 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(){}
|
49
.config/Code/User/History/6e98a3a3/lcUV.cpp
Normal file
49
.config/Code/User/History/6e98a3a3/lcUV.cpp
Normal 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;
|
||||
}
|
75
.config/Code/User/History/6e98a3a3/nMvj.cpp
Normal file
75
.config/Code/User/History/6e98a3a3/nMvj.cpp
Normal 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(){}
|
70
.config/Code/User/History/6e98a3a3/oX90.cpp
Normal file
70
.config/Code/User/History/6e98a3a3/oX90.cpp
Normal 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(){}
|
80
.config/Code/User/History/6e98a3a3/pPrP.cpp
Normal file
80
.config/Code/User/History/6e98a3a3/pPrP.cpp
Normal 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(){}
|
70
.config/Code/User/History/6e98a3a3/pg3Y.cpp
Normal file
70
.config/Code/User/History/6e98a3a3/pg3Y.cpp
Normal 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(){}
|
46
.config/Code/User/History/6e98a3a3/ti49.cpp
Normal file
46
.config/Code/User/History/6e98a3a3/ti49.cpp
Normal 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;
|
||||
}
|
51
.config/Code/User/History/6e98a3a3/uQqz.cpp
Normal file
51
.config/Code/User/History/6e98a3a3/uQqz.cpp
Normal 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;
|
||||
}
|
77
.config/Code/User/History/6e98a3a3/ue5T.cpp
Normal file
77
.config/Code/User/History/6e98a3a3/ue5T.cpp
Normal 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(){}
|
73
.config/Code/User/History/6e98a3a3/wSVi.cpp
Normal file
73
.config/Code/User/History/6e98a3a3/wSVi.cpp
Normal 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(){}
|
71
.config/Code/User/History/6e98a3a3/wpm9.cpp
Normal file
71
.config/Code/User/History/6e98a3a3/wpm9.cpp
Normal 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(){}
|
70
.config/Code/User/History/6e98a3a3/xoEB.cpp
Normal file
70
.config/Code/User/History/6e98a3a3/xoEB.cpp
Normal 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(){}
|
69
.config/Code/User/History/6e98a3a3/yClm.cpp
Normal file
69
.config/Code/User/History/6e98a3a3/yClm.cpp
Normal 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(){}
|
70
.config/Code/User/History/6e98a3a3/ysEt.cpp
Normal file
70
.config/Code/User/History/6e98a3a3/ysEt.cpp
Normal 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(){}
|
Loading…
Add table
Add a link
Reference in a new issue