Revert "allow user choose between game modes, pvp, pvc, cvc"
i need to test it
This reverts commit a6c218061d.
This commit is contained in:
@@ -36,15 +36,12 @@ enum game_statuses : uint8_t {
|
|||||||
game_statuses game_status= TIMER;
|
game_statuses game_status= TIMER;
|
||||||
|
|
||||||
Ball ball(4, 6);
|
Ball ball(4, 6);
|
||||||
|
HumanPaddle p1(1, P1_BTN_UP, P1_BTN_BOTTOM);
|
||||||
Paddle* p1 = nullptr;
|
// HumanPaddle p2(4, P2_BTN_UP, P2_BTN_BOTTOM);
|
||||||
Paddle* p2 = nullptr;
|
// BotPaddle p1(1, 0, 2);
|
||||||
HumanPaddle human_p1(1, P1_BTN_UP, P1_BTN_BOTTOM);
|
BotPaddle p2(4, MATRIX_WIDTH-1, 1);
|
||||||
HumanPaddle human_p2(4, P2_BTN_UP, P2_BTN_BOTTOM);
|
Engine engine(p1, p2, ball, INITIAL_BALL_DELAY);
|
||||||
BotPaddle bot_p1(1, 0, 2);
|
Renderer renderer(p1, p2, ball, frame, matrix);
|
||||||
BotPaddle bot_p2(4, MATRIX_WIDTH-1, 1);
|
|
||||||
Engine engine(*p1, *p2, ball, INITIAL_BALL_DELAY);
|
|
||||||
Renderer renderer(*p1, *p2, ball, frame, matrix);
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
@@ -65,23 +62,11 @@ void loop() {
|
|||||||
switch (game_status) {
|
switch (game_status) {
|
||||||
|
|
||||||
case MENU:
|
case MENU:
|
||||||
// TODO render menu on matrix
|
// show menu on the matrix
|
||||||
// i could use slideshow
|
|
||||||
// 1. P vs P
|
// 1. P vs P
|
||||||
if (digitalRead(P1_BTN_UP) == LOW) {
|
|
||||||
p1= &human_p1;
|
|
||||||
p2= &human_p2;
|
|
||||||
}
|
|
||||||
// 2. P vs CPU
|
// 2. P vs CPU
|
||||||
else if (digitalRead(P1_BTN_BOTTOM) == LOW) {
|
|
||||||
p1= &human_p1;
|
|
||||||
p2= &bot_p2;
|
|
||||||
}
|
|
||||||
// 3. CPU vs CPU
|
// 3. CPU vs CPU
|
||||||
else if (digitalRead(P2_BTN_UP) == LOW) {
|
// slideshow menu
|
||||||
p1= &bot_p1;
|
|
||||||
p2= &bot_p2;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TIMER:
|
case TIMER:
|
||||||
@@ -116,7 +101,7 @@ void loop() {
|
|||||||
renderer.render_score();
|
renderer.render_score();
|
||||||
engine.restart_ball();
|
engine.restart_ball();
|
||||||
delay(1000);
|
delay(1000);
|
||||||
if (p1->get_score() >= MAX_POINTS || p2->get_score() >= MAX_POINTS)
|
if (p1.get_score() >= MAX_POINTS || p2.get_score() >= MAX_POINTS)
|
||||||
game_status= GAMEOVER;
|
game_status= GAMEOVER;
|
||||||
else {
|
else {
|
||||||
game_status= RUN;
|
game_status= RUN;
|
||||||
|
|||||||
Reference in New Issue
Block a user