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