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@39:0c2521949429, 2019-05-07 (annotated)
- Committer:
- el17sm
- Date:
- Tue May 07 09:43:36 2019 +0000
- Revision:
- 39:0c2521949429
- Parent:
- 37:a404860171a9
- Child:
- 40:cbcbf6fc1421
Draws in layers;
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 | 29:6b8411bb040a | 10 | |
el17sm | 26:abbc19edc5c1 | 11 | #include "N5110.h" |
el17sm | 25:112cbcb0b4a7 | 12 | |
el17sm | 26:abbc19edc5c1 | 13 | #define MAX_ENEMIES 10 |
el17sm | 26:abbc19edc5c1 | 14 | |
el17sm | 26:abbc19edc5c1 | 15 | 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 | 16 | { |
el17sm | 29:6b8411bb040a | 17 | private: |
el17sm | 27:a1b41626f57c | 18 | bool _doorways[4]; |
el17sm | 28:98848e6a77a2 | 19 | int _room_type; |
el17sm | 29:6b8411bb040a | 20 | int _enemy_coord[MAX_ENEMIES][2]; // _enemy_coord[EnemyID][x/y] |
el17sm | 27:a1b41626f57c | 21 | |
el17sm | 27:a1b41626f57c | 22 | // Functions |
el17sm | 29:6b8411bb040a | 23 | void draw_walls(N5110 &lcd); |
el17sm | 29:6b8411bb040a | 24 | void draw_walls_overlay(N5110 &lcd); |
el17sm | 39:0c2521949429 | 25 | void init_normal_room(int no_of_enemies); |
el17sm | 39:0c2521949429 | 26 | void init_middle_walled_room(int no_of_enemies); |
el17sm | 39:0c2521949429 | 27 | void init_side_walled_room(int no_of_enemies); |
el17sm | 39:0c2521949429 | 28 | void init_boss_room(int no_of_enemies); |
el17sm | 25:112cbcb0b4a7 | 29 | |
el17sm | 29:6b8411bb040a | 30 | public: |
el17sm | 26:abbc19edc5c1 | 31 | // Constructors |
el17sm | 36:92d131695e7c | 32 | Room(int no_of_enemies, int room_type); |
el17sm | 27:a1b41626f57c | 33 | // Deconstructors |
el17sm | 27:a1b41626f57c | 34 | ~Room(); |
el17sm | 27:a1b41626f57c | 35 | |
el17sm | 27:a1b41626f57c | 36 | // Accessors |
el17sm | 34:1d5b4da3935e | 37 | char * get_current_map_2d(); |
el17sm | 29:6b8411bb040a | 38 | bool * get_doorways(); |
el17sm | 25:112cbcb0b4a7 | 39 | |
el17sm | 26:abbc19edc5c1 | 40 | // Functions |
el17sm | 28:98848e6a77a2 | 41 | void load(); |
el17sm | 28:98848e6a77a2 | 42 | void unload(); |
el17sm | 27:a1b41626f57c | 43 | void draw_room(N5110 &lcd); |
el17sm | 27:a1b41626f57c | 44 | void draw_room_overlay(N5110 &lcd); |
el17sm | 39:0c2521949429 | 45 | void draw_enemies(N5110 &lcd, int j); |
el17sm | 39:0c2521949429 | 46 | void draw_collectibles(N5110 &lcd, int j); |
el17sm | 26:abbc19edc5c1 | 47 | |
el17sm | 26:abbc19edc5c1 | 48 | // Variables |
el17sm | 26:abbc19edc5c1 | 49 | Entity *enemies[MAX_ENEMIES]; |
el17sm | 26:abbc19edc5c1 | 50 | bool valid_enemies[MAX_ENEMIES]; |
el17sm | 36:92d131695e7c | 51 | Entity *collectibles[MAX_ENEMIES]; |
el17sm | 36:92d131695e7c | 52 | bool valid_collectibles[MAX_ENEMIES]; |
el17sm | 28:98848e6a77a2 | 53 | int enemies_type[MAX_ENEMIES]; |
el17sm | 25:112cbcb0b4a7 | 54 | }; |
el17sm | 25:112cbcb0b4a7 | 55 | |
el17sm | 33:4f3948dcd2f7 | 56 | const char wall_x[2][11][3] = { // [E/W][Size_Y][Size_X] |
el17sm | 27:a1b41626f57c | 57 | { // E |
el17sm | 28:98848e6a77a2 | 58 | {1,2,2}, |
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 | 27:a1b41626f57c | 69 | }, |
el17sm | 27:a1b41626f57c | 70 | { // W |
el17sm | 28:98848e6a77a2 | 71 | {2,2,1}, |
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 | 27:a1b41626f57c | 82 | } |
el17sm | 27:a1b41626f57c | 83 | }; |
el17sm | 27:a1b41626f57c | 84 | |
el17sm | 33:4f3948dcd2f7 | 85 | const char wall_n[10][12] = { // [Size_Y][Size_X] |
el17sm | 29:6b8411bb040a | 86 | {0,0,0,0,0,0,0,0,0,0,0,0,}, |
el17sm | 29:6b8411bb040a | 87 | {0,0,0,0,0,0,0,0,0,0,0,0,}, |
el17sm | 29:6b8411bb040a | 88 | {1,1,1,1,1,1,1,1,1,1,1,1,}, |
el17sm | 29:6b8411bb040a | 89 | {0,0,0,0,0,0,0,0,0,0,0,0,}, |
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 | {1,1,1,1,1,1,1,1,1,1,1,1,}, |
el17sm | 27:a1b41626f57c | 96 | }; |
el17sm | 27:a1b41626f57c | 97 | |
el17sm | 33:4f3948dcd2f7 | 98 | const char wall_s[3][12] = { // [Size_Y][Size_X] |
el17sm | 29:6b8411bb040a | 99 | {1,1,1,1,1,1,1,1,1,1,1,1,}, |
el17sm | 29:6b8411bb040a | 100 | {2,2,2,2,2,2,2,2,2,2,2,2,}, |
el17sm | 29:6b8411bb040a | 101 | {2,2,2,2,2,2,2,2,2,2,2,2,}, |
el17sm | 27:a1b41626f57c | 102 | }; |
el17sm | 27:a1b41626f57c | 103 | |
el17sm | 25:112cbcb0b4a7 | 104 | #endif |