A rouge-like rpg, heavily inspired on the binding of isaac. Running on a FRDM-K64F Mbed board. C++.

Dependencies:   mbed MotionSensor

Committer:
el17sm
Date:
Tue May 07 09:09:38 2019 +0000
Revision:
38:09832e662803
Parent:
37:a404860171a9
Attempted creation of mob Cowboy

Who changed what in which revision?

UserRevisionLine numberNew 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 25:112cbcb0b4a7 25
el17sm 29:6b8411bb040a 26 public:
el17sm 26:abbc19edc5c1 27 // Constructors
el17sm 36:92d131695e7c 28 Room(int no_of_enemies, int room_type);
el17sm 27:a1b41626f57c 29 // Deconstructors
el17sm 27:a1b41626f57c 30 ~Room();
el17sm 27:a1b41626f57c 31
el17sm 27:a1b41626f57c 32 // Accessors
el17sm 34:1d5b4da3935e 33 char * get_current_map_2d();
el17sm 29:6b8411bb040a 34 bool * get_doorways();
el17sm 25:112cbcb0b4a7 35
el17sm 26:abbc19edc5c1 36 // Functions
el17sm 28:98848e6a77a2 37 void load();
el17sm 28:98848e6a77a2 38 void unload();
el17sm 27:a1b41626f57c 39 void draw_room(N5110 &lcd);
el17sm 27:a1b41626f57c 40 void draw_room_overlay(N5110 &lcd);
el17sm 32:fe6359ef9916 41 void draw_enemies(N5110 &lcd);
el17sm 37:a404860171a9 42 void draw_collectibles(N5110 &lcd);
el17sm 26:abbc19edc5c1 43
el17sm 26:abbc19edc5c1 44 // Variables
el17sm 26:abbc19edc5c1 45 Entity *enemies[MAX_ENEMIES];
el17sm 26:abbc19edc5c1 46 bool valid_enemies[MAX_ENEMIES];
el17sm 38:09832e662803 47 Entity *proj_enemies[MAX_ENEMIES];
el17sm 38:09832e662803 48 bool valid_proj_enemies[MAX_ENEMIES];
el17sm 36:92d131695e7c 49 Entity *collectibles[MAX_ENEMIES];
el17sm 36:92d131695e7c 50 bool valid_collectibles[MAX_ENEMIES];
el17sm 28:98848e6a77a2 51 int enemies_type[MAX_ENEMIES];
el17sm 25:112cbcb0b4a7 52 };
el17sm 25:112cbcb0b4a7 53
el17sm 33:4f3948dcd2f7 54 const char wall_x[2][11][3] = { // [E/W][Size_Y][Size_X]
el17sm 27:a1b41626f57c 55 { // E
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 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 27:a1b41626f57c 67 },
el17sm 27:a1b41626f57c 68 { // W
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 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 27:a1b41626f57c 80 }
el17sm 27:a1b41626f57c 81 };
el17sm 27:a1b41626f57c 82
el17sm 33:4f3948dcd2f7 83 const char wall_n[10][12] = { // [Size_Y][Size_X]
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 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 {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 {1,1,1,1,1,1,1,1,1,1,1,1,},
el17sm 27:a1b41626f57c 94 };
el17sm 27:a1b41626f57c 95
el17sm 33:4f3948dcd2f7 96 const char wall_s[3][12] = { // [Size_Y][Size_X]
el17sm 29:6b8411bb040a 97 {1,1,1,1,1,1,1,1,1,1,1,1,},
el17sm 29:6b8411bb040a 98 {2,2,2,2,2,2,2,2,2,2,2,2,},
el17sm 29:6b8411bb040a 99 {2,2,2,2,2,2,2,2,2,2,2,2,},
el17sm 27:a1b41626f57c 100 };
el17sm 27:a1b41626f57c 101
el17sm 25:112cbcb0b4a7 102 #endif