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
Diff: ModeA/ModeA.cpp
- Revision:
- 18:59befe1eaa56
- Parent:
- 16:7b179005cd91
- Child:
- 19:5e3ee84d9233
--- a/ModeA/ModeA.cpp Thu May 09 02:37:27 2019 +0000
+++ b/ModeA/ModeA.cpp Thu May 09 03:05:48 2019 +0000
@@ -1,47 +1,40 @@
#include "ModeA.h"
-ModeA::ModeA()
+ModeA::ModeA() //constructor
{
}
-ModeA::~ModeA()
+ModeA::~ModeA() //destructor
{
}
-void ModeA::screen(N5110 &lcd)
-{
-
- lcd.clear();
- lcd.printString("GAME",0,0);
- lcd.printString("Back:Rules",0,2);
-
-};
-
+//initialise all values
void ModeA::initialise(N5110 &lcd)
{
- x_position = 12;
- y_position = 18;
- speed = 1;
- gravity = 1;
+ x_position = 12; //x coordinate of square
+ y_position = 18; //y coordinate of square
+ speed = 1; // speed of square
+ gravity = 1; //gravitational force
- screen_width = 70;
- bar_width = 10;
+ screen_width = 70; // pixel at which bar begins
+ bar_width = 10; // width of the bar
- bar_speed = 2;
- score = 0;
+ bar_speed = 2; // spped of the bar
+ score = 0; // score
srand(time(NULL));
- size_top = rand() % 15;
+ size_top = rand() % 15; //15 random lengths of the top bar
srand(time(NULL));
- size_bottom = rand() % 15;
+ size_bottom = rand() % 15; //15 random length of the bottom bar
}
-void ModeA::Bird(N5110 &lcd)
+//game function
+void ModeA::Game(N5110 &lcd)
{