![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
baseline features - a little buggy
Dependencies: mbed wave_player 4DGL-uLCD-SE MMA8452
player_public.h@2:cf4e61c051a4, 2021-04-10 (annotated)
- Committer:
- robbiehuey
- Date:
- Sat Apr 10 02:08:02 2021 +0000
- Revision:
- 2:cf4e61c051a4
- Parent:
- 1:4421c1e849e9
hi
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DCchico |
0:95264f964374 | 1 | //================================================================= |
DCchico |
0:95264f964374 | 2 | // The header file is for module "player" |
DCchico |
0:95264f964374 | 3 | // |
DCchico |
0:95264f964374 | 4 | // Copyright 2020 Georgia Tech. All rights reserved. |
DCchico |
0:95264f964374 | 5 | // The materials provided by the instructor in this course are for |
DCchico |
0:95264f964374 | 6 | // the use of the students currently enrolled in the course. |
DCchico |
0:95264f964374 | 7 | // Copyrighted course materials may not be further disseminated. |
DCchico |
0:95264f964374 | 8 | // This file must not be made publicly available anywhere. |
DCchico |
0:95264f964374 | 9 | //================================================================== |
DCchico |
0:95264f964374 | 10 | #ifndef PLAYER_PUBLIC_H |
DCchico |
0:95264f964374 | 11 | #define PLAYER_PUBLIC_H |
DCchico |
0:95264f964374 | 12 | |
DCchico |
0:95264f964374 | 13 | #include "doubly_linked_list.h" |
DCchico |
0:95264f964374 | 14 | |
DCchico |
0:95264f964374 | 15 | typedef struct { |
DCchico |
0:95264f964374 | 16 | int y; // The y-coordinate of knife current position |
DCchico |
0:95264f964374 | 17 | int height; |
DCchico |
0:95264f964374 | 18 | int score; // Current score |
DCchico |
0:95264f964374 | 19 | int knife_length; |
DCchico |
0:95264f964374 | 20 | boundingBox knife_boundingBox; |
DCchico |
0:95264f964374 | 21 | bool player_has_knife; // The knife status: 0->In the air 1->With Player |
DCchico |
0:95264f964374 | 22 | } PLAYER; |
DCchico |
0:95264f964374 | 23 | |
DCchico |
0:95264f964374 | 24 | /** getter for user to acquire info without accessing structure |
DCchico |
0:95264f964374 | 25 | */ |
DCchico |
0:95264f964374 | 26 | PLAYER player_get_info(void); |
DCchico |
0:95264f964374 | 27 | |
DCchico |
0:95264f964374 | 28 | /** Initialize all values in the PLAYER struct, then draw the player |
DCchico |
0:95264f964374 | 29 | */ |
DCchico |
0:95264f964374 | 30 | void player_init(void); |
DCchico |
0:95264f964374 | 31 | |
DCchico |
0:95264f964374 | 32 | /** Check if player's current location is valid, then move the player |
DCchico |
0:95264f964374 | 33 | * "player.height" pixels up |
DCchico |
0:95264f964374 | 34 | */ |
DCchico |
0:95264f964374 | 35 | void player_moveUp(void); |
DCchico |
0:95264f964374 | 36 | |
DCchico |
0:95264f964374 | 37 | /** Check if player's current location is valid, then move the player |
DCchico |
0:95264f964374 | 38 | * "player.height" pixels down |
DCchico |
0:95264f964374 | 39 | */ |
DCchico |
0:95264f964374 | 40 | void player_moveDown(void); |
DCchico |
0:95264f964374 | 41 | |
DCchico |
0:95264f964374 | 42 | /** Throw knife by only by changing a value in the PLAYER struct |
DCchico |
0:95264f964374 | 43 | */ |
DCchico |
0:95264f964374 | 44 | void player_throw(void); |
DCchico |
0:95264f964374 | 45 | |
DCchico |
0:95264f964374 | 46 | /** Check the status of the knife in the PLAYER struct and draw the knife |
DCchico |
0:95264f964374 | 47 | * accordingly |
DCchico |
0:95264f964374 | 48 | */ |
DCchico |
0:95264f964374 | 49 | void player_knife_draw(void); |
DCchico |
0:95264f964374 | 50 | |
DCchico |
0:95264f964374 | 51 | /** Draw the player |
DCchico |
0:95264f964374 | 52 | */ |
DCchico |
0:95264f964374 | 53 | void player_draw(int color); |
DCchico |
0:95264f964374 | 54 | |
DCchico |
0:95264f964374 | 55 | /** Reset knife's coordinates so that it comes back to the player's position, |
DCchico |
0:95264f964374 | 56 | * then redraw the knife |
DCchico |
0:95264f964374 | 57 | */ |
DCchico |
0:95264f964374 | 58 | void player_knife_return(void); |
DCchico |
0:95264f964374 | 59 | |
DCchico |
0:95264f964374 | 60 | /** Increment the score by 1 |
DCchico |
0:95264f964374 | 61 | */ |
DCchico |
0:95264f964374 | 62 | void player_score_inc(void); |
DCchico |
0:95264f964374 | 63 | |
robbiehuey | 1:4421c1e849e9 | 64 | void knife_move(void); |
robbiehuey | 1:4421c1e849e9 | 65 | |
DCchico |
0:95264f964374 | 66 | #endif //PLAYER_PUBLIC_H |