A rouge-like rpg, heavily inspired on the binding of isaac. Running on a FRDM-K64F Mbed board. C++.
Dependencies: mbed MotionSensor
RoomEngine/Room/Room.h@40:cbcbf6fc1421, 2019-05-07 (annotated)
- Committer:
- el17sm
- Date:
- Tue May 07 12:42:12 2019 +0000
- Revision:
- 40:cbcbf6fc1421
- Parent:
- 39:0c2521949429
- Child:
- 41:0697508a28ba
Restart Works
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el17sm | 25:112cbcb0b4a7 | 1 | #ifndef ROOM_H |
el17sm | 25:112cbcb0b4a7 | 2 | #define ROOM_H |
el17sm | 27:a1b41626f57c | 3 | #include "sprites.h" |
el17sm | 29:6b8411bb040a | 4 | |
el17sm | 26:abbc19edc5c1 | 5 | #include "Entity.h" |
el17sm | 25:112cbcb0b4a7 | 6 | #include "Player.h" |
el17sm | 25:112cbcb0b4a7 | 7 | #include "Headless.h" |
el17sm | 25:112cbcb0b4a7 | 8 | #include "Snake.h" |
el17sm | 36:92d131695e7c | 9 | #include "Skull.h" |
el17sm | 40:cbcbf6fc1421 | 10 | #include "Walls.h" |
el17sm | 29:6b8411bb040a | 11 | |
el17sm | 26:abbc19edc5c1 | 12 | #include "N5110.h" |
el17sm | 25:112cbcb0b4a7 | 13 | |
el17sm | 26:abbc19edc5c1 | 14 | #define MAX_ENEMIES 10 |
el17sm | 26:abbc19edc5c1 | 15 | |
el17sm | 26:abbc19edc5c1 | 16 | class Room // contains the type of room, number of enemies inside it, the doorways existing in the room, functions to spawn enemies |
el17sm | 25:112cbcb0b4a7 | 17 | { |
el17sm | 29:6b8411bb040a | 18 | private: |
el17sm | 27:a1b41626f57c | 19 | bool _doorways[4]; |
el17sm | 28:98848e6a77a2 | 20 | int _room_type; |
el17sm | 29:6b8411bb040a | 21 | int _enemy_coord[MAX_ENEMIES][2]; // _enemy_coord[EnemyID][x/y] |
el17sm | 27:a1b41626f57c | 22 | |
el17sm | 27:a1b41626f57c | 23 | // Functions |
el17sm | 29:6b8411bb040a | 24 | void draw_walls(N5110 &lcd); |
el17sm | 29:6b8411bb040a | 25 | void draw_walls_overlay(N5110 &lcd); |
el17sm | 39:0c2521949429 | 26 | void init_normal_room(int no_of_enemies); |
el17sm | 39:0c2521949429 | 27 | void init_middle_walled_room(int no_of_enemies); |
el17sm | 39:0c2521949429 | 28 | void init_side_walled_room(int no_of_enemies); |
el17sm | 39:0c2521949429 | 29 | void init_boss_room(int no_of_enemies); |
el17sm | 25:112cbcb0b4a7 | 30 | |
el17sm | 29:6b8411bb040a | 31 | public: |
el17sm | 26:abbc19edc5c1 | 32 | // Constructors |
el17sm | 36:92d131695e7c | 33 | Room(int no_of_enemies, int room_type); |
el17sm | 27:a1b41626f57c | 34 | // Deconstructors |
el17sm | 27:a1b41626f57c | 35 | ~Room(); |
el17sm | 27:a1b41626f57c | 36 | |
el17sm | 27:a1b41626f57c | 37 | // Accessors |
el17sm | 34:1d5b4da3935e | 38 | char * get_current_map_2d(); |
el17sm | 29:6b8411bb040a | 39 | bool * get_doorways(); |
el17sm | 25:112cbcb0b4a7 | 40 | |
el17sm | 26:abbc19edc5c1 | 41 | // Functions |
el17sm | 28:98848e6a77a2 | 42 | void load(); |
el17sm | 28:98848e6a77a2 | 43 | void unload(); |
el17sm | 27:a1b41626f57c | 44 | void draw_room(N5110 &lcd); |
el17sm | 27:a1b41626f57c | 45 | void draw_room_overlay(N5110 &lcd); |
el17sm | 39:0c2521949429 | 46 | void draw_enemies(N5110 &lcd, int j); |
el17sm | 39:0c2521949429 | 47 | void draw_collectibles(N5110 &lcd, int j); |
el17sm | 26:abbc19edc5c1 | 48 | |
el17sm | 26:abbc19edc5c1 | 49 | // Variables |
el17sm | 26:abbc19edc5c1 | 50 | Entity *enemies[MAX_ENEMIES]; |
el17sm | 26:abbc19edc5c1 | 51 | bool valid_enemies[MAX_ENEMIES]; |
el17sm | 36:92d131695e7c | 52 | Entity *collectibles[MAX_ENEMIES]; |
el17sm | 36:92d131695e7c | 53 | bool valid_collectibles[MAX_ENEMIES]; |
el17sm | 28:98848e6a77a2 | 54 | int enemies_type[MAX_ENEMIES]; |
el17sm | 25:112cbcb0b4a7 | 55 | }; |
el17sm | 25:112cbcb0b4a7 | 56 | |
el17sm | 33:4f3948dcd2f7 | 57 | const char wall_x[2][11][3] = { // [E/W][Size_Y][Size_X] |
el17sm | 27:a1b41626f57c | 58 | { // E |
el17sm | 28:98848e6a77a2 | 59 | {1,2,2}, |
el17sm | 28:98848e6a77a2 | 60 | {1,2,2}, |
el17sm | 28:98848e6a77a2 | 61 | {1,2,2}, |
el17sm | 28:98848e6a77a2 | 62 | {1,2,2}, |
el17sm | 28:98848e6a77a2 | 63 | {1,2,2}, |
el17sm | 28:98848e6a77a2 | 64 | {1,2,2}, |
el17sm | 28:98848e6a77a2 | 65 | {1,2,2}, |
el17sm | 28:98848e6a77a2 | 66 | {1,2,2}, |
el17sm | 28:98848e6a77a2 | 67 | {1,2,2}, |
el17sm | 28:98848e6a77a2 | 68 | {1,2,2}, |
el17sm | 28:98848e6a77a2 | 69 | {1,2,2}, |
el17sm | 27:a1b41626f57c | 70 | }, |
el17sm | 27:a1b41626f57c | 71 | { // W |
el17sm | 28:98848e6a77a2 | 72 | {2,2,1}, |
el17sm | 28:98848e6a77a2 | 73 | {2,2,1}, |
el17sm | 28:98848e6a77a2 | 74 | {2,2,1}, |
el17sm | 28:98848e6a77a2 | 75 | {2,2,1}, |
el17sm | 28:98848e6a77a2 | 76 | {2,2,1}, |
el17sm | 28:98848e6a77a2 | 77 | {2,2,1}, |
el17sm | 28:98848e6a77a2 | 78 | {2,2,1}, |
el17sm | 28:98848e6a77a2 | 79 | {2,2,1}, |
el17sm | 28:98848e6a77a2 | 80 | {2,2,1}, |
el17sm | 28:98848e6a77a2 | 81 | {2,2,1}, |
el17sm | 28:98848e6a77a2 | 82 | {2,2,1}, |
el17sm | 27:a1b41626f57c | 83 | } |
el17sm | 27:a1b41626f57c | 84 | }; |
el17sm | 27:a1b41626f57c | 85 | |
el17sm | 33:4f3948dcd2f7 | 86 | const char wall_n[10][12] = { // [Size_Y][Size_X] |
el17sm | 29:6b8411bb040a | 87 | {0,0,0,0,0,0,0,0,0,0,0,0,}, |
el17sm | 29:6b8411bb040a | 88 | {0,0,0,0,0,0,0,0,0,0,0,0,}, |
el17sm | 29:6b8411bb040a | 89 | {1,1,1,1,1,1,1,1,1,1,1,1,}, |
el17sm | 29:6b8411bb040a | 90 | {0,0,0,0,0,0,0,0,0,0,0,0,}, |
el17sm | 29:6b8411bb040a | 91 | {0,0,0,0,0,0,0,0,0,0,0,0,}, |
el17sm | 29:6b8411bb040a | 92 | {0,0,0,0,0,0,0,0,0,0,0,0,}, |
el17sm | 29:6b8411bb040a | 93 | {0,0,0,0,0,0,0,0,0,0,0,0,}, |
el17sm | 29:6b8411bb040a | 94 | {0,0,0,0,0,0,0,0,0,0,0,0,}, |
el17sm | 29:6b8411bb040a | 95 | {0,0,0,0,0,0,0,0,0,0,0,0,}, |
el17sm | 29:6b8411bb040a | 96 | {1,1,1,1,1,1,1,1,1,1,1,1,}, |
el17sm | 27:a1b41626f57c | 97 | }; |
el17sm | 27:a1b41626f57c | 98 | |
el17sm | 33:4f3948dcd2f7 | 99 | const char wall_s[3][12] = { // [Size_Y][Size_X] |
el17sm | 29:6b8411bb040a | 100 | {1,1,1,1,1,1,1,1,1,1,1,1,}, |
el17sm | 29:6b8411bb040a | 101 | {2,2,2,2,2,2,2,2,2,2,2,2,}, |
el17sm | 29:6b8411bb040a | 102 | {2,2,2,2,2,2,2,2,2,2,2,2,}, |
el17sm | 27:a1b41626f57c | 103 | }; |
el17sm | 27:a1b41626f57c | 104 | |
el17sm | 25:112cbcb0b4a7 | 105 | #endif |