![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
ECE 4180 Final
Dependencies: mbed wave_player mbed-rtos C12832_lcd 4DGL-uLCD-SE LCD_fonts SDFileSystem
Bubble.cpp@19:d65f9fb1023b, 2019-12-06 (annotated)
- Committer:
- jcrane32
- Date:
- Fri Dec 06 15:46:16 2019 +0000
- Revision:
- 19:d65f9fb1023b
Added lanes, bubbles, and all the other stuff required for there to be the actual game.
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 | } |