![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Thomas Foster 201 096 550 Re published. Please check time of final commit
Coin/Coin.h@9:3a0194c87afe, 2019-05-12 (annotated)
- Committer:
- el17ttds
- Date:
- Sun May 12 16:21:08 2019 +0000
- Revision:
- 9:3a0194c87afe
- Parent:
- 8:d1c04f0e4890
Final Submission. I have read and agreed with Statement of Academic Integrity.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el17ttds | 9:3a0194c87afe | 1 | /** My Coin Class |
el17ttds | 9:3a0194c87afe | 2 | * @brief Stores and draws location and sprite data for one coin. |
el17ttds | 9:3a0194c87afe | 3 | * @author Thomas Foster |
el17ttds | 9:3a0194c87afe | 4 | * @date May, 2019 |
el17ttds | 9:3a0194c87afe | 5 | */ |
el17ttds | 8:d1c04f0e4890 | 6 | #include "mbed.h" |
el17ttds | 8:d1c04f0e4890 | 7 | #include "N5110.h" |
el17ttds | 8:d1c04f0e4890 | 8 | #include "Gamepad.h" |
el17ttds | 8:d1c04f0e4890 | 9 | |
el17ttds | 8:d1c04f0e4890 | 10 | class Coin { |
el17ttds | 8:d1c04f0e4890 | 11 | |
el17ttds | 8:d1c04f0e4890 | 12 | public: |
el17ttds | 9:3a0194c87afe | 13 | |
el17ttds | 9:3a0194c87afe | 14 | /** Constructor */ |
el17ttds | 8:d1c04f0e4890 | 15 | Coin(); |
el17ttds | 9:3a0194c87afe | 16 | |
el17ttds | 9:3a0194c87afe | 17 | /** Initialises coins variables |
el17ttds | 9:3a0194c87afe | 18 | */ |
el17ttds | 8:d1c04f0e4890 | 19 | void init(); |
el17ttds | 9:3a0194c87afe | 20 | |
el17ttds | 9:3a0194c87afe | 21 | /** Initialises coin location if becomes true |
el17ttds | 9:3a0194c87afe | 22 | * @param x position (int) |
el17ttds | 9:3a0194c87afe | 23 | * @param y position (int) |
el17ttds | 9:3a0194c87afe | 24 | */ |
el17ttds | 8:d1c04f0e4890 | 25 | void set(int x, int y); |
el17ttds | 9:3a0194c87afe | 26 | |
el17ttds | 9:3a0194c87afe | 27 | /** Re writes coin location |
el17ttds | 9:3a0194c87afe | 28 | * @param x position (int) |
el17ttds | 9:3a0194c87afe | 29 | * @param y position (int) |
el17ttds | 9:3a0194c87afe | 30 | */ |
el17ttds | 8:d1c04f0e4890 | 31 | void write(int x1, int y1); |
el17ttds | 9:3a0194c87afe | 32 | |
el17ttds | 9:3a0194c87afe | 33 | /** Draws Coin sprite on screen |
el17ttds | 9:3a0194c87afe | 34 | * @param The N5110 library (N5110) |
el17ttds | 9:3a0194c87afe | 35 | */ |
el17ttds | 8:d1c04f0e4890 | 36 | void draw(N5110 &lcd); |
el17ttds | 9:3a0194c87afe | 37 | |
el17ttds | 9:3a0194c87afe | 38 | /** Gets score |
el17ttds | 9:3a0194c87afe | 39 | * @return current score (int) |
el17ttds | 9:3a0194c87afe | 40 | */ |
el17ttds | 8:d1c04f0e4890 | 41 | int get_score(); |
el17ttds | 8:d1c04f0e4890 | 42 | private: |
el17ttds | 8:d1c04f0e4890 | 43 | void position(); |
el17ttds | 8:d1c04f0e4890 | 44 | void collected(); |
el17ttds | 8:d1c04f0e4890 | 45 | void expire(); |
el17ttds | 8:d1c04f0e4890 | 46 | |
el17ttds | 8:d1c04f0e4890 | 47 | int frame_counter; |
el17ttds | 8:d1c04f0e4890 | 48 | int score; |
el17ttds | 8:d1c04f0e4890 | 49 | int _ctrue; |
el17ttds | 8:d1c04f0e4890 | 50 | |
el17ttds | 8:d1c04f0e4890 | 51 | int _x; |
el17ttds | 8:d1c04f0e4890 | 52 | int _y; |
el17ttds | 8:d1c04f0e4890 | 53 | int _pix_x; |
el17ttds | 8:d1c04f0e4890 | 54 | int _pix_y; |
el17ttds | 8:d1c04f0e4890 | 55 | }; |