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.
Dependencies: mbed FXOS8700CQ mbed-rtos
Diff: Game_two/Game_two.cpp
- Revision:
- 19:903d67bb0dea
- Parent:
- 15:a65444eb1194
- Child:
- 21:704d938acf5d
--- a/Game_two/Game_two.cpp Sun Apr 21 11:07:43 2019 +0000
+++ b/Game_two/Game_two.cpp Sun Apr 21 12:14:59 2019 +0000
@@ -23,7 +23,7 @@
// Set the character being drawn
_cha = cha;
- // Set the random parameter for coin/block ratio
+ // Set the random parameter for determining difficulty level
_rand = r;
// initialize round counter
@@ -33,7 +33,7 @@
// Game initiation
_p1.init();
- // 4 possibilities. 3 for coin, 1 for block.
+ // Create random parameter to determine which social app should be drawn
srand(time(NULL));
_type = rand() % 4; // randomise type.
_so = rand() % 3;
@@ -59,7 +59,7 @@
// draw player on lcd
if(alt <= 1){_p1.draw(lcd, cha);}
else {_p1.draw_alt(lcd, cha);}
- // spawn coin
+ // spawn app icon
if(_type < _rand) {
if (_so == 0) {_insta.draw(lcd);}
else if (_so == 1) {_face.draw(lcd);}
@@ -98,14 +98,14 @@
void Game_two::check_insta_collide(Gamepad &pad, N5110 &lcd, int cha)
{
- // read current coin attributes
+ // read current object attributes
Vector2D insta_pos = _insta.get_pos();
Vector2D insta_speed = _insta.get_velocity();
// check p1 first
Vector2D p1_pos = _p1.get_pos();
- // see if coin has hit the player by checking for overlaps
+ // see if object has hit the player by checking for overlaps
if (cha == 1){
if (
(insta_pos.y >= p1_pos.y - 8) && //top
@@ -162,14 +162,14 @@
void Game_two::check_face_collide(Gamepad &pad, N5110 &lcd, int cha)
{
- // read current coin attributes
+ // read current object attributes
Vector2D face_pos = _face.get_pos();
Vector2D face_speed = _face.get_velocity();
// check p1 first
Vector2D p1_pos = _p1.get_pos();
- // see if coin has hit the player by checking for overlaps
+ // see if object has hit the player by checking for overlaps
if (cha == 1){
if (
(face_pos.y >= p1_pos.y - 8) && //top
@@ -226,14 +226,14 @@
void Game_two::check_twitt_collide(Gamepad &pad, N5110 &lcd, int cha)
{
- // read current coin attributes
+ // read current object attributes
Vector2D twitt_pos = _twitt.get_pos();
Vector2D twitt_speed = _twitt.get_velocity();
// check p1 first
Vector2D p1_pos = _p1.get_pos();
- // see if coin has hit the player by checking for overlaps
+ // see if object has hit the player by checking for overlaps
if (cha == 1){
if (
(twitt_pos.y >= p1_pos.y - 8) && //top
@@ -290,14 +290,14 @@
void Game_two::check_yt_collide(Gamepad &pad, N5110 &lcd, int cha)
{
- // read current coin attributes
+ // read current object attributes
Vector2D yt_pos = _yt.get_pos();
Vector2D yt_speed = _yt.get_velocity();
// check p1 first
Vector2D p1_pos = _p1.get_pos();
- // see if coin has hit the player by checking for overlaps
+ // see if object has hit the player by checking for overlaps
if (cha == 1){
if (
(yt_pos.y >= p1_pos.y - 8) && //top