Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: BreakoutEngine/BreakoutEngine.cpp
- Revision:
- 33:e47f6fa1d9ce
- Parent:
- 32:4dba7a85dbb2
- Child:
- 34:07ded1f83c59
--- a/BreakoutEngine/BreakoutEngine.cpp Wed Apr 24 06:33:04 2019 +0000
+++ b/BreakoutEngine/BreakoutEngine.cpp Thu Apr 25 18:51:59 2019 +0000
@@ -199,7 +199,7 @@
check_wall_collision(pad);
check_paddle_collisions(pad);
check_brick_collisions(pad);
- //check_laser_collisions(pad);
+ check_laser_collisions(pad);
}
void BreakoutEngine::lives_leds(Gamepad &pad)
@@ -758,7 +758,7 @@
_ball.set_pos(ball_pos);
}
-/*
+
void BreakoutEngine::check_laser_collisions(Gamepad &pad)
{
// read current ball attributes
@@ -782,12 +782,12 @@
laser1_pos.x = -10;
// audio feedback
pad.tone(1000.0,0.1);
- if(_brick11.hit() == true) {
+ //if(_brick11.hit() == true) {
_brick11_pos.x = -100;
_brick11_pos.y = -100;
_brick11.set_pos(_brick11_pos);
one_less();
- }
+ //}
//delete _brick11;
}
@@ -805,12 +805,12 @@
laser1_pos.x = -10;
// audio feedback
pad.tone(1000.0,0.1);
- if(_brick12.hit() == true) {
+ //if(_brick12.hit() == true) {
_brick12_pos.x = -100;
_brick12_pos.y = -100;
_brick12.set_pos(_brick11_pos);
one_less();
- }
+ //}
}
// check p1 first
Vector2D _brick13_pos = _brick13.get_pos();
@@ -826,12 +826,12 @@
laser1_pos.x = -10;
// audio feedback
pad.tone(1000.0,0.1);
- if(_brick13.hit() == true) {
+ //if(_brick13.hit() == true) {
_brick13_pos.x = -100;
_brick13_pos.y = -100;
_brick13.set_pos(_brick11_pos);
one_less();
- }
+ //}
}
// check p1 first
Vector2D _brick14_pos = _brick14.get_pos();
@@ -847,12 +847,12 @@
laser1_pos.x = -10;
// audio feedback
pad.tone(1000.0,0.1);
- if(_brick14.hit() == true) {
+ //if(_brick14.hit() == true) {
_brick14_pos.x = -100;
_brick14_pos.y = -100;
_brick14.set_pos(_brick11_pos);
one_less();
- }
+ //}
}
// check p1 first
Vector2D _brick15_pos = _brick15.get_pos();
@@ -868,12 +868,12 @@
laser1_pos.x = -10;
// audio feedback
pad.tone(1000.0,0.1);
- if(_brick15.hit() == true) {
+ //if(_brick15.hit() == true) {
_brick15_pos.x = -100;
_brick15_pos.y = -100;
_brick15.set_pos(_brick11_pos);
one_less();
- }
+ //}
}
// check p1 first
Vector2D _brick16_pos = _brick16.get_pos();
@@ -889,12 +889,12 @@
laser1_pos.x = -10;
// audio feedback
pad.tone(1000.0,0.1);
- if(_brick16.hit() == true) {
+ //if(_brick16.hit() == true) {
_brick16_pos.x = -100;
_brick16_pos.y = -100;
_brick16.set_pos(_brick11_pos);
one_less();
- }
+ //}
}
// check p1 first
Vector2D _brick21_pos = _brick21.get_pos();
@@ -910,12 +910,12 @@
laser1_pos.x = -10;
// audio feedback
pad.tone(1000.0,0.1);
- if(_brick21.hit() == true) {
+ //if(_brick21.hit() == true) {
_brick21_pos.x = -100;
_brick21_pos.y = -100;
_brick21.set_pos(_brick11_pos);
one_less();
- }
+ //}
}
// check p1 first
Vector2D _brick22_pos = _brick22.get_pos();
@@ -931,12 +931,12 @@
laser1_pos.x = -10;
// audio feedback
pad.tone(1000.0,0.1);
- if(_brick22.hit() == true) {
+ //if(_brick22.hit() == true) {
_brick22_pos.x = -100;
_brick22_pos.y = -100;
_brick22.set_pos(_brick11_pos);
one_less();
- }
+ //}
}
// check p1 first
Vector2D _brick23_pos = _brick23.get_pos();
@@ -952,12 +952,12 @@
laser1_pos.x = -10;
// audio feedback
pad.tone(1000.0,0.1);
- if(_brick23.hit() == true) {
+ //if(_brick23.hit() == true) {
_brick23_pos.x = -100;
_brick23_pos.y = -100;
_brick23.set_pos(_brick11_pos);
one_less();
- }
+ //}
}
// check p1 first
Vector2D _brick24_pos = _brick24.get_pos();
@@ -973,12 +973,12 @@
laser1_pos.x = -10;
// audio feedback
pad.tone(1000.0,0.1);
- if(_brick24.hit() == true) {
+ //if(_brick24.hit() == true) {
_brick24_pos.x = -100;
_brick24_pos.y = -100;
_brick24.set_pos(_brick11_pos);
one_less();
- }
+ //}
}
// check p1 first
Vector2D _brick25_pos = _brick25.get_pos();
@@ -994,12 +994,12 @@
laser1_pos.x = -10;
// audio feedback
pad.tone(1000.0,0.1);
- if(_brick25.hit() == true) {
+ //if(_brick25.hit() == true) {
_brick25_pos.x = -100;
_brick25_pos.y = -100;
_brick25.set_pos(_brick11_pos);
one_less();
- }
+ //}
}
// check p1 first
Vector2D _brick26_pos = _brick26.get_pos();
@@ -1015,12 +1015,12 @@
laser1_pos.x = -10;
// audio feedback
pad.tone(1000.0,0.1);
- if(_brick26.hit() == true) {
+ //if(_brick26.hit() == true) {
_brick26_pos.x = -100;
_brick26_pos.y = -100;
_brick26.set_pos(_brick11_pos);
one_less();
- }
+ //}
}
// check p1 first
Vector2D _brick31_pos = _brick31.get_pos();
@@ -1036,12 +1036,12 @@
laser1_pos.x = -10;
// audio feedback
pad.tone(1000.0,0.1);
- if(_brick31.hit() == true) {
+ //if(_brick31.hit() == true) {
_brick31_pos.x = -100;
_brick31_pos.y = -100;
_brick31.set_pos(_brick11_pos);
one_less();
- }
+ //}
}
// check p1 first
Vector2D _brick32_pos = _brick32.get_pos();
@@ -1057,12 +1057,12 @@
laser1_pos.x = -10;
// audio feedback
pad.tone(1000.0,0.1);
- if(_brick32.hit() == true) {
+ //if(_brick32.hit() == true) {
_brick32_pos.x = -100;
_brick32_pos.y = -100;
_brick32.set_pos(_brick11_pos);
one_less();
- }
+ //}
}
// check p1 first
Vector2D _brick33_pos = _brick33.get_pos();
@@ -1078,12 +1078,12 @@
laser1_pos.x = -10;
// audio feedback
pad.tone(1000.0,0.1);
- if(_brick33.hit() == true) {
+ //if(_brick33.hit() == true) {
_brick33_pos.x = -100;
_brick33_pos.y = -100;
_brick33.set_pos(_brick11_pos);
one_less();
- }
+ //}
}
// check p1 first
Vector2D _brick34_pos = _brick34.get_pos();
@@ -1099,12 +1099,12 @@
laser1_pos.x = -10;
// audio feedback
pad.tone(1000.0,0.1);
- if(_brick34.hit() == true) {
+ //if(_brick34.hit() == true) {
_brick34_pos.x = -100;
_brick34_pos.y = -100;
_brick34.set_pos(_brick11_pos);
one_less();
- }
+ //}
}
// check p1 first
Vector2D _brick35_pos = _brick35.get_pos();
@@ -1120,12 +1120,12 @@
laser1_pos.x = -10;
// audio feedback
pad.tone(1000.0,0.1);
- if(_brick35.hit() == true) {
+ //if(_brick35.hit() == true) {
_brick35_pos.x = -100;
_brick35_pos.y = -100;
_brick35.set_pos(_brick11_pos);
one_less();
- }
+ //}
}
// check p1 first
Vector2D _brick36_pos = _brick36.get_pos();
@@ -1141,18 +1141,18 @@
laser1_pos.x = -10;
// audio feedback
pad.tone(1000.0,0.1);
- if(_brick36.hit() == true) {
+ //if(_brick36.hit() == true) {
_brick36_pos.x = -100;
_brick36_pos.y = -100;
_brick36.set_pos(_brick11_pos);
one_less();
- }
+ //}
}
// write new attributes
_laser1.set_pos(laser1_pos);
}
-*/
+
bool BreakoutEngine::check_goal(Gamepad &pad)
{
Vector2D ball_pos = _ball.get_pos();