Basic game using accelerometer and LCD screen. You can move and dodge asteroids coming from both left and right. There is no scoring at the moment.
Dependencies: C12832 FXOS8700Q mbed-rtos mbed
Asteroid.h@2:9e0c826103d7, 2016-02-17 (annotated)
- Committer:
- co838_gtvl2
- Date:
- Wed Feb 17 10:14:33 2016 +0000
- Revision:
- 2:9e0c826103d7
- Parent:
- 1:c6734b909bf0
Unrealisable because memory in cpp isn't that good :(
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
co838_gtvl2 | 0:9ec880239b3c | 1 | #ifndef _ASTEROID_H_ |
co838_gtvl2 | 0:9ec880239b3c | 2 | # define _ASTEROID_H_ |
co838_gtvl2 | 0:9ec880239b3c | 3 | |
co838_gtvl2 | 0:9ec880239b3c | 4 | # include "main.h" |
co838_gtvl2 | 0:9ec880239b3c | 5 | # include "Player.h" |
co838_gtvl2 | 0:9ec880239b3c | 6 | |
co838_gtvl2 | 0:9ec880239b3c | 7 | class Asteroid |
co838_gtvl2 | 0:9ec880239b3c | 8 | { |
co838_gtvl2 | 0:9ec880239b3c | 9 | public: |
co838_gtvl2 | 1:c6734b909bf0 | 10 | Asteroid(); |
co838_gtvl2 | 1:c6734b909bf0 | 11 | ~Asteroid(); |
co838_gtvl2 | 2:9e0c826103d7 | 12 | int getX() const; |
co838_gtvl2 | 2:9e0c826103d7 | 13 | int getY() const; |
co838_gtvl2 | 2:9e0c826103d7 | 14 | bool move(Player*); |
co838_gtvl2 | 0:9ec880239b3c | 15 | private: |
co838_gtvl2 | 2:9e0c826103d7 | 16 | char inc; // -1 / +1 |
co838_gtvl2 | 2:9e0c826103d7 | 17 | unsigned short int x; // 127 => 0 / 0 => 127 |
co838_gtvl2 | 2:9e0c826103d7 | 18 | float a; // [A] * x + b |
co838_gtvl2 | 2:9e0c826103d7 | 19 | unsigned short int b; // a * x + [B] |
co838_gtvl2 | 0:9ec880239b3c | 20 | }; |
co838_gtvl2 | 0:9ec880239b3c | 21 | |
co838_gtvl2 | 0:9ec880239b3c | 22 | #endif /* _ASTEROID_H_ */ |