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@30:ec915d24d3e9, 2019-05-05 (annotated)
- Committer:
- el17sm
- Date:
- Sun May 05 18:04:43 2019 +0000
- Revision:
- 30:ec915d24d3e9
- Parent:
- Room/Room.h@29:6b8411bb040a
- Child:
- 32:fe6359ef9916
Title Screen done;
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 | 29:6b8411bb040a | 9 | |
el17sm | 26:abbc19edc5c1 | 10 | #include "N5110.h" |
el17sm | 25:112cbcb0b4a7 | 11 | |
el17sm | 26:abbc19edc5c1 | 12 | #define MAX_ENEMIES 10 |
el17sm | 26:abbc19edc5c1 | 13 | |
el17sm | 26:abbc19edc5c1 | 14 | 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 | 15 | { |
el17sm | 29:6b8411bb040a | 16 | private: |
el17sm | 27:a1b41626f57c | 17 | bool _doorways[4]; |
el17sm | 28:98848e6a77a2 | 18 | int _room_type; |
el17sm | 29:6b8411bb040a | 19 | int _enemy_coord[MAX_ENEMIES][2]; // _enemy_coord[EnemyID][x/y] |
el17sm | 27:a1b41626f57c | 20 | |
el17sm | 27:a1b41626f57c | 21 | // Functions |
el17sm | 29:6b8411bb040a | 22 | void draw_walls(N5110 &lcd); |
el17sm | 29:6b8411bb040a | 23 | void draw_walls_overlay(N5110 &lcd); |
el17sm | 25:112cbcb0b4a7 | 24 | |
el17sm | 29:6b8411bb040a | 25 | public: |
el17sm | 26:abbc19edc5c1 | 26 | // Constructors |
el17sm | 28:98848e6a77a2 | 27 | Room(int no_of_enemies); |
el17sm | 27:a1b41626f57c | 28 | // Deconstructors |
el17sm | 27:a1b41626f57c | 29 | ~Room(); |
el17sm | 27:a1b41626f57c | 30 | |
el17sm | 27:a1b41626f57c | 31 | // Accessors |
el17sm | 27:a1b41626f57c | 32 | int * get_current_map_2d(); |
el17sm | 29:6b8411bb040a | 33 | bool * get_doorways(); |
el17sm | 25:112cbcb0b4a7 | 34 | |
el17sm | 26:abbc19edc5c1 | 35 | // Functions |
el17sm | 28:98848e6a77a2 | 36 | void load(); |
el17sm | 28:98848e6a77a2 | 37 | void unload(); |
el17sm | 27:a1b41626f57c | 38 | void draw_room(N5110 &lcd); |
el17sm | 27:a1b41626f57c | 39 | void draw_room_overlay(N5110 &lcd); |
el17sm | 26:abbc19edc5c1 | 40 | |
el17sm | 26:abbc19edc5c1 | 41 | // Variables |
el17sm | 26:abbc19edc5c1 | 42 | Entity *enemies[MAX_ENEMIES]; |
el17sm | 26:abbc19edc5c1 | 43 | bool valid_enemies[MAX_ENEMIES]; |
el17sm | 28:98848e6a77a2 | 44 | int enemies_type[MAX_ENEMIES]; |
el17sm | 25:112cbcb0b4a7 | 45 | }; |
el17sm | 25:112cbcb0b4a7 | 46 | |
el17sm | 27:a1b41626f57c | 47 | const int wall_x[2][11][3] = { // [E/W][Size_Y][Size_X] |
el17sm | 27:a1b41626f57c | 48 | { // E |
el17sm | 28:98848e6a77a2 | 49 | {1,2,2}, |
el17sm | 28:98848e6a77a2 | 50 | {1,2,2}, |
el17sm | 28:98848e6a77a2 | 51 | {1,2,2}, |
el17sm | 28:98848e6a77a2 | 52 | {1,2,2}, |
el17sm | 28:98848e6a77a2 | 53 | {1,2,2}, |
el17sm | 28:98848e6a77a2 | 54 | {1,2,2}, |
el17sm | 28:98848e6a77a2 | 55 | {1,2,2}, |
el17sm | 28:98848e6a77a2 | 56 | {1,2,2}, |
el17sm | 28:98848e6a77a2 | 57 | {1,2,2}, |
el17sm | 28:98848e6a77a2 | 58 | {1,2,2}, |
el17sm | 28:98848e6a77a2 | 59 | {1,2,2}, |
el17sm | 27:a1b41626f57c | 60 | }, |
el17sm | 27:a1b41626f57c | 61 | { // W |
el17sm | 28:98848e6a77a2 | 62 | {2,2,1}, |
el17sm | 28:98848e6a77a2 | 63 | {2,2,1}, |
el17sm | 28:98848e6a77a2 | 64 | {2,2,1}, |
el17sm | 28:98848e6a77a2 | 65 | {2,2,1}, |
el17sm | 28:98848e6a77a2 | 66 | {2,2,1}, |
el17sm | 28:98848e6a77a2 | 67 | {2,2,1}, |
el17sm | 28:98848e6a77a2 | 68 | {2,2,1}, |
el17sm | 28:98848e6a77a2 | 69 | {2,2,1}, |
el17sm | 28:98848e6a77a2 | 70 | {2,2,1}, |
el17sm | 28:98848e6a77a2 | 71 | {2,2,1}, |
el17sm | 28:98848e6a77a2 | 72 | {2,2,1}, |
el17sm | 27:a1b41626f57c | 73 | } |
el17sm | 27:a1b41626f57c | 74 | }; |
el17sm | 27:a1b41626f57c | 75 | |
el17sm | 29:6b8411bb040a | 76 | const int wall_n[10][12] = { // [Size_Y][Size_X] |
el17sm | 29:6b8411bb040a | 77 | {0,0,0,0,0,0,0,0,0,0,0,0,}, |
el17sm | 29:6b8411bb040a | 78 | {0,0,0,0,0,0,0,0,0,0,0,0,}, |
el17sm | 29:6b8411bb040a | 79 | {1,1,1,1,1,1,1,1,1,1,1,1,}, |
el17sm | 29:6b8411bb040a | 80 | {0,0,0,0,0,0,0,0,0,0,0,0,}, |
el17sm | 29:6b8411bb040a | 81 | {0,0,0,0,0,0,0,0,0,0,0,0,}, |
el17sm | 29:6b8411bb040a | 82 | {0,0,0,0,0,0,0,0,0,0,0,0,}, |
el17sm | 29:6b8411bb040a | 83 | {0,0,0,0,0,0,0,0,0,0,0,0,}, |
el17sm | 29:6b8411bb040a | 84 | {0,0,0,0,0,0,0,0,0,0,0,0,}, |
el17sm | 29:6b8411bb040a | 85 | {0,0,0,0,0,0,0,0,0,0,0,0,}, |
el17sm | 29:6b8411bb040a | 86 | {1,1,1,1,1,1,1,1,1,1,1,1,}, |
el17sm | 27:a1b41626f57c | 87 | }; |
el17sm | 27:a1b41626f57c | 88 | |
el17sm | 29:6b8411bb040a | 89 | const int wall_s[3][12] = { // [Size_Y][Size_X] |
el17sm | 29:6b8411bb040a | 90 | {1,1,1,1,1,1,1,1,1,1,1,1,}, |
el17sm | 29:6b8411bb040a | 91 | {2,2,2,2,2,2,2,2,2,2,2,2,}, |
el17sm | 29:6b8411bb040a | 92 | {2,2,2,2,2,2,2,2,2,2,2,2,}, |
el17sm | 27:a1b41626f57c | 93 | }; |
el17sm | 27:a1b41626f57c | 94 | |
el17sm | 25:112cbcb0b4a7 | 95 | #endif |