A rouge-like rpg, heavily inspired on the binding of isaac. Running on a FRDM-K64F Mbed board. C++.
Dependencies: mbed MotionSensor
RoomEngine/RoomEngine.h@29:6b8411bb040a, 2019-05-04 (annotated)
- Committer:
- el17sm
- Date:
- Sat May 04 15:39:20 2019 +0000
- Revision:
- 29:6b8411bb040a
- Parent:
- 28:98848e6a77a2
- Child:
- 30:ec915d24d3e9
added Room complete;; started Floor engine;; ; To do:; Floor generation;; More enemies;; Bosses;; Title Screen;; Score;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el17sm | 26:abbc19edc5c1 | 1 | #ifndef ROOMENGINE_H |
el17sm | 26:abbc19edc5c1 | 2 | #define ROOMENGINE_H |
el17sm | 28:98848e6a77a2 | 3 | #include "N5110.h" |
el17sm | 29:6b8411bb040a | 4 | #include "Gamepad.h" |
el17sm | 29:6b8411bb040a | 5 | |
el17sm | 26:abbc19edc5c1 | 6 | #include "Player.h" |
el17sm | 29:6b8411bb040a | 7 | #include "Health.h" |
el17sm | 26:abbc19edc5c1 | 8 | #include "Room.h" |
el17sm | 29:6b8411bb040a | 9 | |
el17sm | 26:abbc19edc5c1 | 10 | #include "sprites.h" |
el17sm | 29:6b8411bb040a | 11 | |
el17sm | 26:abbc19edc5c1 | 12 | |
el17sm | 27:a1b41626f57c | 13 | class RoomEngine |
el17sm | 26:abbc19edc5c1 | 14 | { |
el17sm | 26:abbc19edc5c1 | 15 | public: |
el17sm | 27:a1b41626f57c | 16 | RoomEngine(); |
el17sm | 27:a1b41626f57c | 17 | ~RoomEngine(); |
el17sm | 29:6b8411bb040a | 18 | void load(Player ¤t_player, Room *current_room); |
el17sm | 28:98848e6a77a2 | 19 | void entrance_scene(N5110 &lcd, Gamepad &gamepad); |
el17sm | 28:98848e6a77a2 | 20 | void exit_scene(N5110 &lcd, Gamepad &gamepad); |
el17sm | 29:6b8411bb040a | 21 | void update_current_room(); |
el17sm | 29:6b8411bb040a | 22 | |
el17sm | 26:abbc19edc5c1 | 23 | void read_input(Gamepad &gamepad); |
el17sm | 27:a1b41626f57c | 24 | void update(); |
el17sm | 27:a1b41626f57c | 25 | void render(N5110 &lcd, Gamepad &gamepad); |
el17sm | 27:a1b41626f57c | 26 | bool check_player_death(); |
el17sm | 28:98848e6a77a2 | 27 | int check_player_room_position(); |
el17sm | 26:abbc19edc5c1 | 28 | |
el17sm | 29:6b8411bb040a | 29 | // Accessor |
el17sm | 29:6b8411bb040a | 30 | int get_room_x(); |
el17sm | 29:6b8411bb040a | 31 | int get_room_y(); |
el17sm | 29:6b8411bb040a | 32 | |
el17sm | 26:abbc19edc5c1 | 33 | private: |
el17sm | 26:abbc19edc5c1 | 34 | bool _L; |
el17sm | 26:abbc19edc5c1 | 35 | bool _R; |
el17sm | 26:abbc19edc5c1 | 36 | bool _A; |
el17sm | 26:abbc19edc5c1 | 37 | bool _B; |
el17sm | 26:abbc19edc5c1 | 38 | bool _X; |
el17sm | 26:abbc19edc5c1 | 39 | bool _Y; |
el17sm | 26:abbc19edc5c1 | 40 | Vector2D mapped_coord; |
el17sm | 26:abbc19edc5c1 | 41 | |
el17sm | 29:6b8411bb040a | 42 | int _room_x; |
el17sm | 29:6b8411bb040a | 43 | int _room_y; |
el17sm | 29:6b8411bb040a | 44 | |
el17sm | 27:a1b41626f57c | 45 | Room *room; |
el17sm | 27:a1b41626f57c | 46 | Player *player; |
el17sm | 26:abbc19edc5c1 | 47 | |
el17sm | 28:98848e6a77a2 | 48 | // Mutator |
el17sm | 28:98848e6a77a2 | 49 | void set_input(bool L, bool R, bool A, bool B, bool X, bool Y, float mapped_x, float mapped_y); |
el17sm | 28:98848e6a77a2 | 50 | void set_mapped_coord(float x, float y); |
el17sm | 28:98848e6a77a2 | 51 | |
el17sm | 26:abbc19edc5c1 | 52 | // Functions |
el17sm | 28:98848e6a77a2 | 53 | bool entity_collision(Entity &a, Entity &b); |
el17sm | 28:98848e6a77a2 | 54 | float entity_move_check_x(Entity *a, Entity *array[], int no_of_enemies, int current_entity, bool valid_enemies[]); |
el17sm | 28:98848e6a77a2 | 55 | float entity_move_check_y(Entity *a, Entity *array[], int no_of_enemies, int current_entity, bool valid_enemies[]); |
el17sm | 28:98848e6a77a2 | 56 | |
el17sm | 26:abbc19edc5c1 | 57 | void check_damage(); |
el17sm | 26:abbc19edc5c1 | 58 | void check_damage_player(); |
el17sm | 26:abbc19edc5c1 | 59 | void check_damage_enemies(); |
el17sm | 28:98848e6a77a2 | 60 | void check_damage_enemies_by_bullets(); |
el17sm | 28:98848e6a77a2 | 61 | void check_damage_enemies_by_collisions(); |
el17sm | 27:a1b41626f57c | 62 | void check_enemies_death(); |
el17sm | 26:abbc19edc5c1 | 63 | void move(); |
el17sm | 26:abbc19edc5c1 | 64 | void move_player(); |
el17sm | 26:abbc19edc5c1 | 65 | void move_enemies(); |
el17sm | 26:abbc19edc5c1 | 66 | void move_bullets(); |
el17sm | 28:98848e6a77a2 | 67 | void update_player_position(int side); |
el17sm | 28:98848e6a77a2 | 68 | |
el17sm | 27:a1b41626f57c | 69 | void minimap_detection(N5110 &lcd, Gamepad &gamepad); |
el17sm | 27:a1b41626f57c | 70 | void pause_detection(N5110 &lcd, Gamepad &gamepad); |
el17sm | 26:abbc19edc5c1 | 71 | |
el17sm | 27:a1b41626f57c | 72 | void draw(N5110 &lcd); |
el17sm | 26:abbc19edc5c1 | 73 | void draw_player(N5110 &lcd); |
el17sm | 26:abbc19edc5c1 | 74 | void draw_enemies(N5110 &lcd); |
el17sm | 26:abbc19edc5c1 | 75 | void draw_bullets(N5110 &lcd); |
el17sm | 26:abbc19edc5c1 | 76 | void draw_health(N5110 &lcd); |
el17sm | 26:abbc19edc5c1 | 77 | |
el17sm | 26:abbc19edc5c1 | 78 | }; |
el17sm | 26:abbc19edc5c1 | 79 | #endif |