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