ECE 4180 Final
Dependencies: mbed wave_player mbed-rtos C12832_lcd 4DGL-uLCD-SE LCD_fonts SDFileSystem
Bubble.cpp@21:cbcbb3480cad, 2019-12-08 (annotated)
- Committer:
- yqin70
- Date:
- Sun Dec 08 02:18:30 2019 +0000
- Revision:
- 21:cbcbb3480cad
- Parent:
- 19:d65f9fb1023b
somewhat done(pushbutton added, has an issue where if you spam the touchpad, it'll increase your score even if there is no bubble).
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jcrane32 | 19:d65f9fb1023b | 1 | #include "Bubble.hpp" |
jcrane32 | 19:d65f9fb1023b | 2 | |
jcrane32 | 19:d65f9fb1023b | 3 | Bubble::Bubble(int x, int y) { |
jcrane32 | 19:d65f9fb1023b | 4 | xpos = x; |
jcrane32 | 19:d65f9fb1023b | 5 | ypos = y; |
jcrane32 | 19:d65f9fb1023b | 6 | } |
jcrane32 | 19:d65f9fb1023b | 7 | |
jcrane32 | 19:d65f9fb1023b | 8 | void Bubble::draw() { |
jcrane32 | 19:d65f9fb1023b | 9 | uLCD.filled_circle(xpos, ypos, bubbleRadius, 0x000000); |
jcrane32 | 19:d65f9fb1023b | 10 | uLCD.filled_circle(xpos, newypos, bubbleRadius, 0xFFFFFF); |
jcrane32 | 19:d65f9fb1023b | 11 | update(); |
jcrane32 | 19:d65f9fb1023b | 12 | } |
jcrane32 | 19:d65f9fb1023b | 13 | |
jcrane32 | 19:d65f9fb1023b | 14 | void Bubble::clear() { |
jcrane32 | 19:d65f9fb1023b | 15 | uLCD.filled_circle(xpos, newypos, bubbleRadius, 0x000000); |
jcrane32 | 19:d65f9fb1023b | 16 | } |
jcrane32 | 19:d65f9fb1023b | 17 | |
jcrane32 | 19:d65f9fb1023b | 18 | void Bubble::update() { |
jcrane32 | 19:d65f9fb1023b | 19 | ypos = newypos; |
jcrane32 | 19:d65f9fb1023b | 20 | } |
jcrane32 | 19:d65f9fb1023b | 21 | |
jcrane32 | 19:d65f9fb1023b | 22 | void Bubble::moveDown() { |
jcrane32 | 19:d65f9fb1023b | 23 | newypos += bubbleSpeed; |
jcrane32 | 19:d65f9fb1023b | 24 | } |
jcrane32 | 19:d65f9fb1023b | 25 | |
jcrane32 | 19:d65f9fb1023b | 26 | int Bubble::getYpos() { |
jcrane32 | 19:d65f9fb1023b | 27 | return ypos; |
jcrane32 | 19:d65f9fb1023b | 28 | } |