
Simple vertical scrolling space shooter game using navigation switch (joystick), uLCD-144-G2, and a pushbutton switch.
Dependencies: 4DGL-uLCD-SE PinDetect mbed
Display/Shot.cpp@0:5c666e5cd22d, 2016-03-17 (annotated)
- Committer:
- jaspinall3
- Date:
- Thu Mar 17 20:47:11 2016 +0000
- Revision:
- 0:5c666e5cd22d
March 17, 2016 Vertical Scrolling Space Shooter
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jaspinall3 | 0:5c666e5cd22d | 1 | #include "Shot.h" |
jaspinall3 | 0:5c666e5cd22d | 2 | |
jaspinall3 | 0:5c666e5cd22d | 3 | Shot::Shot(int x, int y, int dy, int color, uLCD_4DGL *uLCD) { |
jaspinall3 | 0:5c666e5cd22d | 4 | init(x,y,uLCD); |
jaspinall3 | 0:5c666e5cd22d | 5 | _dy = dy; |
jaspinall3 | 0:5c666e5cd22d | 6 | _color = color; |
jaspinall3 | 0:5c666e5cd22d | 7 | setRadius(1); |
jaspinall3 | 0:5c666e5cd22d | 8 | } |
jaspinall3 | 0:5c666e5cd22d | 9 | int Shot::getY() { |
jaspinall3 | 0:5c666e5cd22d | 10 | return _y; |
jaspinall3 | 0:5c666e5cd22d | 11 | } |
jaspinall3 | 0:5c666e5cd22d | 12 | |
jaspinall3 | 0:5c666e5cd22d | 13 | int Shot::getX() { |
jaspinall3 | 0:5c666e5cd22d | 14 | return _x; |
jaspinall3 | 0:5c666e5cd22d | 15 | } |
jaspinall3 | 0:5c666e5cd22d | 16 | |
jaspinall3 | 0:5c666e5cd22d | 17 | void Shot::update() { |
jaspinall3 | 0:5c666e5cd22d | 18 | _y = _y + _dy; |
jaspinall3 | 0:5c666e5cd22d | 19 | drawCircle(0,0,_color); |
jaspinall3 | 0:5c666e5cd22d | 20 | } |