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,24 @@
#include "Food.h"
#include "util.h"
class RedFood : public Food{
const int width = 20;
const int height = 10;
public:
RedFood(int x, int y) : Food(x, y, colors[RED]){}
void draw() override{
DrawRectangle(x, y , width, height, color);
}
void activatePowerup(Paddle& paddle, Ball& ball) override{
if(Food::counter == 0){
ball.setVX(ball.getVX() < 0 ? -3 : 3);
ball.setVY(ball.getVY() < 0 ? -3 : 3);
powerActive = true;
}
}
~RedFood(){}
};

View file

@ -0,0 +1,14 @@
#include "Food.h"
#include "util.h"
class RedFood : public Food{
const int width = 20;
const int height = 10;
public:
RedFood(int x, int y) : Food(x, y, colors[RED]){}
};

View file

@ -0,0 +1,24 @@
#include "Food.h"
#include "util.h"
class RedFood : public Food{
const int width = 20;
const int height = 10;
public:
RedFood(int x, int y) : Food(x, y, colors[RED]){}
void draw() override{
DrawRectangle(x, y , width, height, color);
}
void activatePowerup(Paddle& paddle, Ball**& balls) override{
if(Food::counter == 0){
ball.setVX(ball.getVX() < 0 ? -7 : 7);
ball.setVY(ball.getVY() < 0 ? -7 : 7);
powerActive = true;
}
}
~RedFood(){}
};

View file

@ -0,0 +1,11 @@
#include "Food.h"
#include "util.h"
class RedFood : public Food{
const int width = 20;
const int height = 10;
};

View file

@ -0,0 +1 @@
{"version":1,"resource":"file:///home/rafayahmad/Stuff/OOP/Project/RedFood.cpp","entries":[{"id":"gm7s.cpp","timestamp":1714703173266},{"id":"OBG1.cpp","timestamp":1714703203483},{"id":"IuYP.cpp","timestamp":1714703239430},{"id":"ihCh.cpp","timestamp":1714703268536},{"id":"qsKG.cpp","timestamp":1714889893808},{"id":"D9pR.cpp","timestamp":1714972728678},{"id":"nyqL.cpp","timestamp":1714972758275},{"id":"ldDL.cpp","timestamp":1714974741241},{"id":"MbM4.cpp","timestamp":1715074840737},{"id":"qXx7.cpp","timestamp":1715074889096}]}

View file

@ -0,0 +1,9 @@
#include "Food.h"
#include "util.h"
class RedFood : public Food{
};

View file

@ -0,0 +1,17 @@
#include "Food.h"
#include "util.h"
class RedFood : public Food{
const int width = 20;
const int height = 10;
public:
RedFood(int x, int y) : Food(x, y, colors[RED]){}
void draw() override{
DrawRectangle(x, y , width, height, color);
}
~RedFood(){}
};

View file

@ -0,0 +1,24 @@
#include "Food.h"
#include "util.h"
class RedFood : public Food{
const int width = 20;
const int height = 10;
public:
RedFood(int x, int y) : Food(x, y, colors[RED]){}
void draw() override{
DrawRectangle(x, y , width, height, color);
}
void activatePowerup(Paddle& paddle, Ball& ball, Ball*& ball1, Ball*& ball2) override{
if(Food::counter == 0){
ball.setVX(ball.getVX() < 0 ? -7 : 7);
ball.setVY(ball.getVY() < 0 ? -7 : 7);
powerActive = true;
}
}
~RedFood(){}
};

View file

@ -0,0 +1,24 @@
#include "Food.h"
#include "util.h"
class RedFood : public Food{
const int width = 20;
const int height = 10;
public:
RedFood(int x, int y) : Food(x, y, colors[RED]){}
void draw() override{
DrawRectangle(x, y , width, height, color);
}
void activatePowerup(Paddle& paddle, Ball& ball) override{
if(Food::counter == 0){
ball.setVX(ball.getVX() < 0 ? -7 : 7);
ball.setVY(ball.getVY() < 0 ? -7 : 7);
powerActive = true;
}
}
~RedFood(){}
};

View file

@ -0,0 +1,28 @@
#include "Food.h"
#include "util.h"
class RedFood : public Food{
const int width = 20;
const int height = 10;
public:
RedFood(int x, int y) : Food(x, y, colors[RED]){}
void draw() override{
DrawRectangle(x, y , width, height, color);
}
void activatePowerup(Paddle& paddle, Ball**& balls) override{
if(Food::counter == 0){
for(int i=0;i<3;i++){
if(balls[i] != nullptr){
balls[i]->setVX(balls[i]->getVX() < 0 ? -7 : 7);
balls[i]->setVY(balls[i]->getVY() < 0 ? -7 : 7);
}
}
powerActive = true;
}
}
~RedFood(){}
};

View file

@ -0,0 +1,19 @@
#include "Food.h"
#include "util.h"
class RedFood : public Food{
const int width = 20;
const int height = 10;
public:
RedFood(int x, int y) : Food(x, y, colors[RED]){}
void draw() override{
DrawRectangle(x, y , width, height, color);
}
void activatePowerup(Paddle& paddle, Ball& ball) override{
}
~RedFood(){}
};