This is the first version of a Fishing Mini-game. It uses a navigational switch as a button and a joystick, playing wav files from a SD card, and a uLCD screen to show the fishing game
Dependencies: 4DGL-uLCD-SE SDFileSystem mbed-rtos mbed wave_player
Diff: Fish.h
- Revision:
- 1:8dd8fafa7fc8
- Parent:
- 0:5d811b6879d5
diff -r 5d811b6879d5 -r 8dd8fafa7fc8 Fish.h --- a/Fish.h Thu Mar 17 18:33:52 2016 +0000 +++ b/Fish.h Thu Mar 17 18:47:33 2016 +0000 @@ -26,9 +26,9 @@ } else { dir = -1; } - size = (rand() % 100) + 20; - time = ((rand() % 5) + 1)*5; - clk = 0; + size = (rand() % 100) + 20; //Size of the fish will determine how fast it can move + time = ((rand() % 5) + 1)*5; //Time determines how long it will either head left or right + clk = 0; //Shows how much time has passed } void Fish::reset() { @@ -52,11 +52,11 @@ return y_pos; } -void Fish::move(int n) { +void Fish::move(int n) { //Changes the x-position of the fish or moves it x_pos = x_pos + n; } -void Fish::movement() { +void Fish::movement() { //The movement of the fish, basically going back and forth if(clk >= time) { clk = 0; time = ((rand() % 5) + 1)*5; @@ -71,7 +71,7 @@ } } -bool Fish::failed() { +bool Fish::failed() { //When it reaches the outer bounds, the fish has escaped if(x_pos < 30 || x_pos > 98) { return false; } else {