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:
Thu May 02 21:30:49 2019 +0000
Revision:
28:98848e6a77a2
Parent:
27:a1b41626f57c
Child:
29:6b8411bb040a
Entrance and Exit done

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 26:abbc19edc5c1 4 #include "Entity.h"
el17sm 25:112cbcb0b4a7 5 #include "Player.h"
el17sm 25:112cbcb0b4a7 6 #include "Headless.h"
el17sm 25:112cbcb0b4a7 7 #include "Snake.h"
el17sm 26:abbc19edc5c1 8 #include "N5110.h"
el17sm 25:112cbcb0b4a7 9
el17sm 26:abbc19edc5c1 10 #define MAX_ENEMIES 10
el17sm 26:abbc19edc5c1 11
el17sm 26:abbc19edc5c1 12 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 13 {
el17sm 25:112cbcb0b4a7 14 private:
el17sm 27:a1b41626f57c 15 bool _doorways[4];
el17sm 28:98848e6a77a2 16 int _room_type;
el17sm 27:a1b41626f57c 17 int _current_map[3][48][84];
el17sm 27:a1b41626f57c 18
el17sm 27:a1b41626f57c 19 // Functions
el17sm 27:a1b41626f57c 20 void overlap(int x, int y, int width, int height, int * object, int * map);
el17sm 28:98848e6a77a2 21 void overlap_wall(int side);
el17sm 25:112cbcb0b4a7 22
el17sm 25:112cbcb0b4a7 23 public:
el17sm 26:abbc19edc5c1 24 // Constructors
el17sm 28:98848e6a77a2 25 Room(int no_of_enemies);
el17sm 27:a1b41626f57c 26 // Deconstructors
el17sm 27:a1b41626f57c 27 ~Room();
el17sm 27:a1b41626f57c 28
el17sm 27:a1b41626f57c 29 // Accessors
el17sm 27:a1b41626f57c 30 int * get_current_map_2d();
el17sm 25:112cbcb0b4a7 31
el17sm 26:abbc19edc5c1 32 // Functions
el17sm 28:98848e6a77a2 33 void load();
el17sm 28:98848e6a77a2 34 void unload();
el17sm 27:a1b41626f57c 35 void draw_room(N5110 &lcd);
el17sm 27:a1b41626f57c 36 void draw_room_overlay(N5110 &lcd);
el17sm 26:abbc19edc5c1 37
el17sm 26:abbc19edc5c1 38 // Variables
el17sm 26:abbc19edc5c1 39 Entity *enemies[MAX_ENEMIES];
el17sm 26:abbc19edc5c1 40 bool valid_enemies[MAX_ENEMIES];
el17sm 28:98848e6a77a2 41 int enemies_type[MAX_ENEMIES];
el17sm 25:112cbcb0b4a7 42 };
el17sm 25:112cbcb0b4a7 43
el17sm 27:a1b41626f57c 44 const int wall_x[2][11][3] = { // [E/W][Size_Y][Size_X]
el17sm 27:a1b41626f57c 45 { // E
el17sm 28:98848e6a77a2 46 {1,2,2},
el17sm 28:98848e6a77a2 47 {1,2,2},
el17sm 28:98848e6a77a2 48 {1,2,2},
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 27:a1b41626f57c 57 },
el17sm 27:a1b41626f57c 58 { // W
el17sm 28:98848e6a77a2 59 {2,2,1},
el17sm 28:98848e6a77a2 60 {2,2,1},
el17sm 28:98848e6a77a2 61 {2,2,1},
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 27:a1b41626f57c 70 }
el17sm 27:a1b41626f57c 71 };
el17sm 27:a1b41626f57c 72
el17sm 27:a1b41626f57c 73 const int wall_n[2][10][12] = { // [2d/3d][Size_Y][Size_X]
el17sm 27:a1b41626f57c 74 { // N
el17sm 27:a1b41626f57c 75 {0,0,0,0,0,0,0,0,0,0,0,0,},
el17sm 27:a1b41626f57c 76 {0,0,0,0,0,0,0,0,0,0,0,0,},
el17sm 27:a1b41626f57c 77 {0,0,0,0,0,0,0,0,0,0,0,0,},
el17sm 27:a1b41626f57c 78 {0,0,0,0,0,0,0,0,0,0,0,0,},
el17sm 27:a1b41626f57c 79 {0,0,0,0,0,0,0,0,0,0,0,0,},
el17sm 27:a1b41626f57c 80 {0,0,0,0,0,0,0,0,0,0,0,0,},
el17sm 27:a1b41626f57c 81 {0,0,0,0,0,0,0,0,0,0,0,0,},
el17sm 27:a1b41626f57c 82 {0,0,0,0,0,0,0,0,0,0,0,0,},
el17sm 27:a1b41626f57c 83 {0,0,0,0,0,0,0,0,0,0,0,0,},
el17sm 27:a1b41626f57c 84 {1,1,1,1,1,1,1,1,1,1,1,1,},
el17sm 27:a1b41626f57c 85 },
el17sm 27:a1b41626f57c 86 {
el17sm 27:a1b41626f57c 87 {0,0,0,0,0,0,0,0,0,0,0,0,},
el17sm 27:a1b41626f57c 88 {0,0,0,0,0,0,0,0,0,0,0,0,},
el17sm 27:a1b41626f57c 89 {1,1,1,1,1,1,1,1,1,1,1,1,},
el17sm 27:a1b41626f57c 90 {0,0,0,0,0,0,0,0,0,0,0,0,},
el17sm 27:a1b41626f57c 91 {0,0,0,0,0,0,0,0,0,0,0,0,},
el17sm 27:a1b41626f57c 92 {0,0,0,0,0,0,0,0,0,0,0,0,},
el17sm 27:a1b41626f57c 93 {0,0,0,0,0,0,0,0,0,0,0,0,},
el17sm 27:a1b41626f57c 94 {0,0,0,0,0,0,0,0,0,0,0,0,},
el17sm 27:a1b41626f57c 95 {0,0,0,0,0,0,0,0,0,0,0,0,},
el17sm 27:a1b41626f57c 96 {1,1,1,1,1,1,1,1,1,1,1,1,},
el17sm 27:a1b41626f57c 97 },
el17sm 27:a1b41626f57c 98 };
el17sm 27:a1b41626f57c 99
el17sm 27:a1b41626f57c 100 const int wall_s[2][3][12] = { // [2d/3d][Size_Y][Size_X]
el17sm 27:a1b41626f57c 101 {
el17sm 27:a1b41626f57c 102 {1,1,1,1,1,1,1,1,1,1,1,1,},
el17sm 27:a1b41626f57c 103 {0,0,0,0,0,0,0,0,0,0,0,0,},
el17sm 27:a1b41626f57c 104 {0,0,0,0,0,0,0,0,0,0,0,0,},
el17sm 27:a1b41626f57c 105 },
el17sm 27:a1b41626f57c 106 {
el17sm 27:a1b41626f57c 107 {1,1,1,1,1,1,1,1,1,1,1,1,},
el17sm 28:98848e6a77a2 108 {2,2,2,2,2,2,2,2,2,2,2,2,},
el17sm 28:98848e6a77a2 109 {2,2,2,2,2,2,2,2,2,2,2,2,},
el17sm 27:a1b41626f57c 110 },
el17sm 27:a1b41626f57c 111 };
el17sm 27:a1b41626f57c 112
el17sm 25:112cbcb0b4a7 113 #endif