finished p2-2

Dependencies:   mbed wave_player 4DGL-uLCD-SE MMA8452

Committer:
levelsnake3
Date:
Sat Apr 17 02:34:03 2021 +0000
Revision:
1:05e3f86df6d5
Parent:
0:95264f964374
Child:
2:7abebe259d59
finished;

Who changed what in which revision?

UserRevisionLine numberNew 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 score; // Current score
DCchico 0:95264f964374 18 int knife_length;
DCchico 0:95264f964374 19 boundingBox knife_boundingBox;
DCchico 0:95264f964374 20 bool player_has_knife; // The knife status: 0->In the air 1->With Player
DCchico 0:95264f964374 21 } PLAYER;
DCchico 0:95264f964374 22
levelsnake3 1:05e3f86df6d5 23 typedef void (*DrawFunc)(boundingBox b);
levelsnake3 1:05e3f86df6d5 24
levelsnake3 1:05e3f86df6d5 25
DCchico 0:95264f964374 26 /** getter for user to acquire info without accessing structure
DCchico 0:95264f964374 27 */
DCchico 0:95264f964374 28 PLAYER player_get_info(void);
DCchico 0:95264f964374 29
DCchico 0:95264f964374 30 /** Initialize all values in the PLAYER struct, then draw the player
DCchico 0:95264f964374 31 */
DCchico 0:95264f964374 32 void player_init(void);
DCchico 0:95264f964374 33
DCchico 0:95264f964374 34 /** Check if player's current location is valid, then move the player
DCchico 0:95264f964374 35 * "player.height" pixels up
DCchico 0:95264f964374 36 */
DCchico 0:95264f964374 37 void player_moveUp(void);
DCchico 0:95264f964374 38
DCchico 0:95264f964374 39 /** Check if player's current location is valid, then move the player
DCchico 0:95264f964374 40 * "player.height" pixels down
DCchico 0:95264f964374 41 */
DCchico 0:95264f964374 42 void player_moveDown(void);
DCchico 0:95264f964374 43
DCchico 0:95264f964374 44 /** Throw knife by only by changing a value in the PLAYER struct
DCchico 0:95264f964374 45 */
DCchico 0:95264f964374 46 void player_throw(void);
DCchico 0:95264f964374 47
DCchico 0:95264f964374 48 /** Check the status of the knife in the PLAYER struct and draw the knife
DCchico 0:95264f964374 49 * accordingly
DCchico 0:95264f964374 50 */
DCchico 0:95264f964374 51 void player_knife_draw(void);
DCchico 0:95264f964374 52
DCchico 0:95264f964374 53 /** Draw the player
DCchico 0:95264f964374 54 */
DCchico 0:95264f964374 55 void player_draw(int color);
DCchico 0:95264f964374 56
levelsnake3 1:05e3f86df6d5 57 boundingBox getKnifeBounding(void);
DCchico 0:95264f964374 58 /** Reset knife's coordinates so that it comes back to the player's position,
DCchico 0:95264f964374 59 * then redraw the knife
DCchico 0:95264f964374 60 */
DCchico 0:95264f964374 61 void player_knife_return(void);
DCchico 0:95264f964374 62
DCchico 0:95264f964374 63 /** Increment the score by 1
DCchico 0:95264f964374 64 */
DCchico 0:95264f964374 65 void player_score_inc(void);
DCchico 0:95264f964374 66
DCchico 0:95264f964374 67 #endif //PLAYER_PUBLIC_H