SharpShooter
Dependencies: 4DGL-uLCD-SE SDFileSystem mbed-rtos mbed wave_player
Shooter.h@6:7f8c3169483a, 2016-10-28 (annotated)
- Committer:
- jboettcher
- Date:
- Fri Oct 28 01:00:49 2016 +0000
- Revision:
- 6:7f8c3169483a
- Parent:
- 5:f51cdddf541e
- Child:
- 11:55b65415b6ba
shooter and obstacle initially done
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jboettcher | 5:f51cdddf541e | 1 | class Shooter |
jboettcher | 5:f51cdddf541e | 2 | { |
jboettcher | 5:f51cdddf541e | 3 | int x; |
jboettcher | 6:7f8c3169483a | 4 | uLCD_4DGL uLCD; |
jboettcher | 6:7f8c3169483a | 5 | |
jboettcher | 5:f51cdddf541e | 6 | public: |
jboettcher | 5:f51cdddf541e | 7 | Shooter(); |
jboettcher | 5:f51cdddf541e | 8 | void drawShooter(); |
jboettcher | 6:7f8c3169483a | 9 | void eraseShooter(); |
jboettcher | 6:7f8c3169483a | 10 | void moveLeft(); |
jboettcher | 6:7f8c3169483a | 11 | void moveRight(); |
jboettcher | 5:f51cdddf541e | 12 | }; |
jboettcher | 5:f51cdddf541e | 13 | |
jboettcher | 5:f51cdddf541e | 14 | Shooter::Shooter() { |
jboettcher | 5:f51cdddf541e | 15 | x = 64; |
jboettcher | 5:f51cdddf541e | 16 | } |
jboettcher | 5:f51cdddf541e | 17 | |
jboettcher | 6:7f8c3169483a | 18 | void Shooter::drawShooter() { |
jboettcher | 6:7f8c3169483a | 19 | uLCD.triangle(x, 115, x-5, 125, x-5, 125, 0x3300ff); |
jboettcher | 6:7f8c3169483a | 20 | } |
jboettcher | 6:7f8c3169483a | 21 | |
jboettcher | 6:7f8c3169483a | 22 | void Shooter::eraseShooter() { |
jboettcher | 6:7f8c3169483a | 23 | uLCD.triangle(x, 115, x-5, 125, x-5, 125, 0x000000); |
jboettcher | 6:7f8c3169483a | 24 | } |
jboettcher | 6:7f8c3169483a | 25 | |
jboettcher | 6:7f8c3169483a | 26 | void Shooter::moveLeft() { |
jboettcher | 6:7f8c3169483a | 27 | eraseShooter(); |
jboettcher | 6:7f8c3169483a | 28 | if (x==64) x = 32; |
jboettcher | 6:7f8c3169483a | 29 | if (x==96) x = 64; |
jboettcher | 6:7f8c3169483a | 30 | drawShooter(); |
jboettcher | 6:7f8c3169483a | 31 | } |
jboettcher | 6:7f8c3169483a | 32 | |
jboettcher | 6:7f8c3169483a | 33 | void Shooter::moveRight() { |
jboettcher | 6:7f8c3169483a | 34 | eraseShooter(); |
jboettcher | 6:7f8c3169483a | 35 | if (x==64) x = 96; |
jboettcher | 6:7f8c3169483a | 36 | if (x==32) x = 64; |
jboettcher | 6:7f8c3169483a | 37 | drawShooter(); |
jboettcher | 6:7f8c3169483a | 38 | } |
jboettcher | 6:7f8c3169483a | 39 | |
jboettcher | 6:7f8c3169483a | 40 | |
jboettcher | 6:7f8c3169483a | 41 |