dotfiles/.config/Code/User/History/-89d9d7e/CYEo.cpp
RafayAhmad7548 ab03d5f10c test
2024-06-16 18:53:25 +05:00

38 lines
No EOL
755 B
C++

#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(){}