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:
Mon May 06 08:56:48 2019 +0000
Revision:
32:fe6359ef9916
Parent:
30:ec915d24d3e9
Child:
33:4f3948dcd2f7
A bit of code cleanup;; Draw functions are now inside the classes;; Moved classes into it's folders;

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 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 32:fe6359ef9916 40 void draw_enemies(N5110 &lcd);
el17sm 26:abbc19edc5c1 41
el17sm 26:abbc19edc5c1 42 // Variables
el17sm 26:abbc19edc5c1 43 Entity *enemies[MAX_ENEMIES];
el17sm 26:abbc19edc5c1 44 bool valid_enemies[MAX_ENEMIES];
el17sm 28:98848e6a77a2 45 int enemies_type[MAX_ENEMIES];
el17sm 25:112cbcb0b4a7 46 };
el17sm 25:112cbcb0b4a7 47
el17sm 27:a1b41626f57c 48 const int wall_x[2][11][3] = { // [E/W][Size_Y][Size_X]
el17sm 27:a1b41626f57c 49 { // E
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 28:98848e6a77a2 60 {1,2,2},
el17sm 27:a1b41626f57c 61 },
el17sm 27:a1b41626f57c 62 { // W
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 28:98848e6a77a2 73 {2,2,1},
el17sm 27:a1b41626f57c 74 }
el17sm 27:a1b41626f57c 75 };
el17sm 27:a1b41626f57c 76
el17sm 29:6b8411bb040a 77 const int wall_n[10][12] = { // [Size_Y][Size_X]
el17sm 29:6b8411bb040a 78 {0,0,0,0,0,0,0,0,0,0,0,0,},
el17sm 29:6b8411bb040a 79 {0,0,0,0,0,0,0,0,0,0,0,0,},
el17sm 29:6b8411bb040a 80 {1,1,1,1,1,1,1,1,1,1,1,1,},
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 {0,0,0,0,0,0,0,0,0,0,0,0,},
el17sm 29:6b8411bb040a 87 {1,1,1,1,1,1,1,1,1,1,1,1,},
el17sm 27:a1b41626f57c 88 };
el17sm 27:a1b41626f57c 89
el17sm 29:6b8411bb040a 90 const int wall_s[3][12] = { // [Size_Y][Size_X]
el17sm 29:6b8411bb040a 91 {1,1,1,1,1,1,1,1,1,1,1,1,},
el17sm 29:6b8411bb040a 92 {2,2,2,2,2,2,2,2,2,2,2,2,},
el17sm 29:6b8411bb040a 93 {2,2,2,2,2,2,2,2,2,2,2,2,},
el17sm 27:a1b41626f57c 94 };
el17sm 27:a1b41626f57c 95
el17sm 25:112cbcb0b4a7 96 #endif