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,28 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
Food::~Food(){}

View file

@ -0,0 +1,38 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(Paddle& paddle, Ball**& balls){
counter = 0;
powerActive = false;
paddle.setWidth(125);
for(int i=0;i<3;i++){
ball.setVX(ball.getVX() < 0 ? -5 : 5);
ball.setVY(ball.getVY() < 0 ? -5 : 5);
}
// if(ball1 != nullptr) delete ball1;
// if(ball2 != nullptr) delete ball2;
}
Food::~Food(){}

View file

@ -0,0 +1,31 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetCounter(){
counter = 0;
}
Food::~Food(){}

View file

@ -0,0 +1,37 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(Paddle& paddle, Ball**& balls){
counter = 0;
powerActive = false;
paddle.setWidth(125);
for(int i=0;i<3;i++){
balls[i]->setVX(balls[i]->getVX() < 0 ? -5 : 5);
balls[i]->setVY(balls[i]->getVY() < 0 ? -5 : 5);
}
// if(ball1 != nullptr) delete ball1;
// if(ball2 != nullptr) delete ball2;
}
Food::~Food(){}

View file

@ -0,0 +1,37 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(Paddle& paddle, Ball**& balls){
counter = 0;
powerActive = false;
paddle.setWidth(125);
for(int i=0;i<3;i++){
if(balls[i] != nullptr){
balls[i]->setVX(balls[i]->getVX() < 0 ? -5 : 5);
balls[i]->setVY(balls[i]->getVY() < 0 ? -5 : 5);
}
}
}
Food::~Food(){}

View file

@ -0,0 +1,41 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(Paddle& paddle, Ball**& balls){
counter = 0;
powerActive = false;
paddle.setWidth(125);
for(int i=1;i<3;i++){
delete balls[i];
balls[i] = nullptr;
}
for(int i=0;i<3;i++){
if(balls[i] != nullptr){
balls[i]->setVX(balls[i]->getVX() < 0 ? -5 : 5);
balls[i]->setVY(balls[i]->getVY() < 0 ? -5 : 5);
}
}
}
Food::~Food(){}

View file

@ -0,0 +1,17 @@
#include "Food.h"
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
Food::~Food(){}

View file

@ -0,0 +1,9 @@
#include "Food.h"
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
bool Food::fall(){
if(y > 0) y -= 5;
else return true;
return false;
}
Food::~Food(){}

View file

@ -0,0 +1,33 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(Paddle& paddle, Ball& ball){
counter = 0;
powerActive = false;
paddle.setWidth(125);
}
Food::~Food(){}

View file

@ -0,0 +1,35 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(Paddle& paddle, Ball& ball){
counter = 0;
powerActive = false;
paddle.setWidth(125);
ball.setVX(ball.getVX() < 0 ? -5 : 5);
ball.setVY(ball.getVY() < 0 ? -5 : 5);
}
Food::~Food(){}

View file

@ -0,0 +1,43 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(Paddle& paddle, Ball**& balls){
counter = 0;
powerActive = false;
// paddle.setWidth(125);
for(int i=1;i<3;i++){
if(balls[i] != nullptr){
delete balls[i];
balls[i] = nullptr;
}
}
for(int i=0;i<3;i++){
if(balls[i] != nullptr){
balls[i]->setVX(balls[i]->getVX() < 0 ? -5 : 5);
balls[i]->setVY(balls[i]->getVY() < 0 ? -5 : 5);
}
}
}
Food::~Food(){}

View file

@ -0,0 +1,28 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
}
Food::~Food(){}

View file

@ -0,0 +1,32 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetCounter(){
counter = 0;
powerActive = false;
}
Food::~Food(){}

View file

@ -0,0 +1,16 @@
#include "Food.h"
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
Food::~Food(){}

View file

@ -0,0 +1,17 @@
#include "Food.h"
Food::counter = 0;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
Food::~Food(){}

View file

@ -0,0 +1,43 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(Paddle& paddle, Ball**& balls){
counter = 0;
powerActive = false;
int ballsLeft = 0;
for(int i=0;i<3;i++){
if(balls[i] != nullptr){
delete balls[i];
balls[i] = nullptr;
}
}
for(int i=0;i<3;i++){
if(balls[i] != nullptr){
balls[i]->setVX(balls[i]->getVX() < 0 ? -5 : 5);
balls[i]->setVY(balls[i]->getVY() < 0 ? -5 : 5);
}
}
}
Food::~Food(){}

View file

@ -0,0 +1,33 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(){
counter = 0;
powerActive = false;
}
Food::~Food(){}

View file

@ -0,0 +1,45 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(Paddle& paddle, Ball**& balls){
counter = 0;
powerActive = false;
int ballsLeft = 0;
for(int i=0;i<3;i++) if(balls[i] != nullptr) ballsLeft++;
for(int i=0;i<3 && ballsLeft>1;i++){
if(balls[i] != nullptr){
delete balls[i];
balls[i] = nullptr;
ballsLeft--;
}
}
for(int i=0;i<3;i++){
if(balls[i] != nullptr){
balls[i]->setVX(balls[i]->getVX() < 0 ? -5 : 5);
balls[i]->setVY(balls[i]->getVY() < 0 ? -5 : 5);
}
}
}
Food::~Food(){}

View file

@ -0,0 +1,24 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
Food::~Food(){}

View file

@ -0,0 +1,21 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
bool Food::getPowerActive(){
return powerActive;
}
Food::~Food(){}

View file

@ -0,0 +1,35 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(Paddle& paddle, Ball**& balls){
counter = 0;
powerActive = false;
paddle.setWidth(125);
// ball.setVX(ball.getVX() < 0 ? -5 : 5);
// ball.setVY(ball.getVY() < 0 ? -5 : 5);
// if(ball1 != nullptr) delete ball1;
// if(ball2 != nullptr) delete ball2;
}
Food::~Food(){}

View file

@ -0,0 +1,32 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(){
counter = 0;
powerActive = false;
}
Food::~Food(){}

View file

@ -0,0 +1,16 @@
#include "Food.h"
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
Food::~Food(){}

View file

@ -0,0 +1,37 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(Paddle& paddle, Ball**& balls){
counter = 0;
powerActive = false;
paddle.setWidth(125);
for(int i=0;i<3;i++){
balls[i]->setVX(ball.getVX() < 0 ? -5 : 5);
balls[i]->setVY(ball.getVY() < 0 ? -5 : 5);
}
// if(ball1 != nullptr) delete ball1;
// if(ball2 != nullptr) delete ball2;
}
Food::~Food(){}

View file

@ -0,0 +1,44 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(Paddle& paddle, Ball**& balls){
counter = 0;
powerActive = false;
int deleteCount = 0;
for(int i=0;i<3 && deleteCount<2;i++){
if(balls[i] != nullptr){
delete balls[i];
balls[i] = nullptr;
deleteCount++;
}
}
for(int i=0;i<3;i++){
if(balls[i] != nullptr){
balls[i]->setVX(balls[i]->getVX() < 0 ? -5 : 5);
balls[i]->setVY(balls[i]->getVY() < 0 ? -5 : 5);
}
}
}
Food::~Food(){}

View file

@ -0,0 +1 @@
{"version":1,"resource":"file:///home/rafayahmad/Stuff/OOP/Project/Food.cpp","entries":[{"id":"nx3D.cpp","timestamp":1714701367830},{"id":"knQ3.cpp","timestamp":1714701378811},{"id":"rbo6.cpp","timestamp":1714702506694},{"id":"fxC6.cpp","timestamp":1714815428059},{"id":"mREs.cpp","timestamp":1714815447666},{"id":"Hqys.cpp","timestamp":1714815485104},{"id":"vC7M.cpp","timestamp":1714822696718},{"id":"RFJY.cpp","timestamp":1714823116389},{"id":"i4G1.cpp","timestamp":1714823839915},{"id":"ioO8.cpp","timestamp":1714823868495},{"id":"buwi.cpp","timestamp":1714888555690},{"id":"vxjF.cpp","timestamp":1714888831430},{"id":"TYaA.cpp","timestamp":1714888873693},{"id":"FaUB.cpp","timestamp":1714888886613},{"id":"yNXy.cpp","timestamp":1714888927807},{"id":"tLnP.cpp","timestamp":1714889152189},{"id":"ZYEh.cpp","timestamp":1714889354967},{"id":"q18N.cpp","timestamp":1714889398730},{"id":"YuHL.cpp","timestamp":1714889438230},{"id":"g4YJ.cpp","timestamp":1714889522006},{"id":"Q1EN.cpp","timestamp":1714889534649},{"id":"7HZK.cpp","timestamp":1714889544989},{"id":"DqEF.cpp","timestamp":1714889728693},{"id":"Q5sZ.cpp","timestamp":1714889759353},{"id":"VAZc.cpp","timestamp":1714890224529},{"id":"bpJQ.cpp","timestamp":1714890260351},{"id":"h7bc.cpp","timestamp":1714890288792},{"id":"IAKI.cpp","timestamp":1714890330336},{"id":"LYJx.cpp","timestamp":1714972112989},{"id":"fM5B.cpp","timestamp":1714975262853},{"id":"wLjp.cpp","timestamp":1714975275879},{"id":"i4Al.cpp","timestamp":1714975289479},{"id":"rMf3.cpp","timestamp":1715077949581},{"id":"u9kf.cpp","timestamp":1715082241135},{"id":"bBuI.cpp","timestamp":1715092101482},{"id":"CYEo.cpp","timestamp":1715093750020},{"id":"dNVo.cpp","timestamp":1715093764850},{"id":"EEIQ.cpp","timestamp":1715093776100},{"id":"ENN9.cpp","timestamp":1715093812180},{"id":"FLrn.cpp","timestamp":1715093833800},{"id":"ipkw.cpp","timestamp":1715093857249},{"id":"Mjmd.cpp","timestamp":1715146546423},{"id":"zDA9.cpp","timestamp":1715161417435},{"id":"ecCI.cpp","timestamp":1715181793188},{"id":"TkZL.cpp","timestamp":1715182024335},{"id":"trEZ.cpp","timestamp":1715182052759},{"id":"XaJf.cpp","timestamp":1715182066863}]}

View file

@ -0,0 +1,35 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(Paddle& paddle, Ball& ball, Ball*& ball1, Ball*& ball2){
counter = 0;
powerActive = false;
paddle.setWidth(125);
ball.setVX(ball.getVX() < 0 ? -5 : 5);
ball.setVY(ball.getVY() < 0 ? -5 : 5);
}
Food::~Food(){}

View file

@ -0,0 +1,8 @@
#include "Food.h"
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
bool Food::fall(){
if(y > 0) y -= 5;
}
Food::~Food(){}

View file

@ -0,0 +1,28 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
count++;
}
Food::~Food(){}

View file

@ -0,0 +1,32 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(Paddle& paddle, Ball& ball){
counter = 0;
powerActive = false;
}
Food::~Food(){}

View file

@ -0,0 +1,37 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(Paddle& paddle, Ball& ball, Ball*& ball1, Ball*& ball2){
counter = 0;
powerActive = false;
paddle.setWidth(125);
ball.setVX(ball.getVX() < 0 ? -5 : 5);
ball.setVY(ball.getVY() < 0 ? -5 : 5);
if(ball1 != nullptr) delete ball1;
if(ball2 != nullptr) delete ball2;
}
Food::~Food(){}

View file

@ -0,0 +1,16 @@
#include "Food.h"
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -10) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
Food::~Food(){}

View file

@ -0,0 +1,16 @@
#include "Food.h"
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
Food::~Food(){}

View file

@ -0,0 +1,43 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(Paddle& paddle, Ball**& balls){
counter = 0;
powerActive = false;
paddle.setWidth(125);
for(int i=1;i<3;i++){
if(balls[i] != nullptr){
delete balls[i];
balls[i] = nullptr;
}
}
for(int i=0;i<3;i++){
if(balls[i] != nullptr){
balls[i]->setVX(balls[i]->getVX() < 0 ? -5 : 5);
balls[i]->setVY(balls[i]->getVY() < 0 ? -5 : 5);
}
}
}
Food::~Food(){}

View file

@ -0,0 +1,4 @@
#include "Food.h"
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
Food::~Food(){}

View file

@ -0,0 +1,9 @@
#include "Food.h"
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
bool Food::fall(){
if(y > 0) y -= 5;
else return false;
return true;
}
Food::~Food(){}

View file

@ -0,0 +1,3 @@
#include "Food.h"
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}

View file

@ -0,0 +1,21 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
bool Food::getPowerActive(){
return powerActive;
}
Food::~Food(){}

View file

@ -0,0 +1,37 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(Paddle& paddle, Ball**& balls){
counter = 0;
powerActive = false;
paddle.setWidth(125);
// ball.setVX(ball.getVX() < 0 ? -5 : 5);
// ball.setVY(ball.getVY() < 0 ? -5 : 5);
// if(ball1 != nullptr) delete ball1;
// if(ball2 != nullptr) delete ball2;
}
Food::~Food(){}

View file

@ -0,0 +1,7 @@
#include "Food.h"
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
y -= 5;
}
Food::~Food(){}

View file

@ -0,0 +1,18 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
Food::~Food(){}

View file

@ -0,0 +1,45 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(Paddle& paddle, Ball**& balls){
counter = 0;
powerActive = false;
int ballsLeft = 0;
for(int i=0;i<3;i++) if(balls[i] != nullptr) ballsLeft++;
for(int i=0;i<3;i++){
if(balls[i] != nullptr){
delete balls[i];
balls[i] = nullptr;
ballsLeft--;
}
}
for(int i=0;i<3;i++){
if(balls[i] != nullptr){
balls[i]->setVX(balls[i]->getVX() < 0 ? -5 : 5);
balls[i]->setVY(balls[i]->getVY() < 0 ? -5 : 5);
}
}
}
Food::~Food(){}

View file

@ -0,0 +1,37 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(Paddle& paddle, Ball**& balls){
counter = 0;
powerActive = false;
paddle.setWidth(125);
// ball.setVX(ball.getVX() < 0 ? -5 : 5);
// ball.setVY(ball.getVY() < 0 ? -5 : 5);
// if(ball1 != nullptr) delete ball1;
// if(ball2 != nullptr) delete ball2;
}
Food::~Food(){}

View file

@ -0,0 +1,16 @@
#include "Food.h"
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
bool Food::fall(){
if(y > 0) y -= 5;
else return true;
return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
Food::~Food(){}

View file

@ -0,0 +1,16 @@
#include "Food.h"
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
Food::~Food(){}

View file

@ -0,0 +1,36 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(Paddle& paddle, Ball& ball, Ball*& ball1, Ball*& ball2){
counter = 0;
powerActive = false;
paddle.setWidth(125);
ball.setVX(ball.getVX() < 0 ? -5 : 5);
ball.setVY(ball.getVY() < 0 ? -5 : 5);
if(ball1 != nullptr) delete ball1;
}
Food::~Food(){}

View file

@ -0,0 +1,17 @@
#include "Food.h"
int Food::counter = 0;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
// else return true;
// return false;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
Food::~Food(){}

View file

@ -0,0 +1,42 @@
#include "Food.h"
int Food::counter = 0;
bool Food::powerActive = false;
Food::Food(int x, int y, float *color) : x(x), y(y), color(color){}
void Food::fall(){
if(y > -20) y -= 5;
}
int Food::getX(){
return x;
}
int Food::getY(){
return y;
}
int Food::getCounter(){
return counter;
}
bool Food::getPowerActive(){
return powerActive;
}
void Food::count(){
counter++;
}
void Food::resetPowerup(Paddle& paddle, Ball**& balls){
counter = 0;
powerActive = false;
for(int i=1;i<3;i++){
if(balls[i] != nullptr){
delete balls[i];
balls[i] = nullptr;
}
}
for(int i=0;i<3;i++){
if(balls[i] != nullptr){
balls[i]->setVX(balls[i]->getVX() < 0 ? -5 : 5);
balls[i]->setVY(balls[i]->getVY() < 0 ? -5 : 5);
}
}
}
Food::~Food(){}