test
This commit is contained in:
parent
37776af5db
commit
ab03d5f10c
4045 changed files with 286212 additions and 3 deletions
41
.config/Code/User/History/-89d9d7e/FLrn.cpp
Normal file
41
.config/Code/User/History/-89d9d7e/FLrn.cpp
Normal 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(){}
|
Loading…
Add table
Add a link
Reference in a new issue