Добавлены локации и перемещение по ним
This commit is contained in:
61
include/location.h
Normal file
61
include/location.h
Normal file
@@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
struct Point {
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
};
|
||||
|
||||
struct Chest {
|
||||
Point pos;
|
||||
int gold = 0;
|
||||
bool opened = false;
|
||||
};
|
||||
|
||||
struct Enemy {
|
||||
Point pos;
|
||||
std::string type;
|
||||
int hp = 50;
|
||||
};
|
||||
|
||||
struct NPC {
|
||||
Point pos;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
struct Riddle {
|
||||
int type = 0;
|
||||
std::string text;
|
||||
std::string answer;
|
||||
bool isSolved = false;
|
||||
};
|
||||
|
||||
class Location {
|
||||
public:
|
||||
int id = 0;
|
||||
std::string title;
|
||||
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
|
||||
int north = 0;
|
||||
int south = 0;
|
||||
int west = 0;
|
||||
int east = 0;
|
||||
|
||||
Point startPosition;
|
||||
Riddle riddle;
|
||||
|
||||
std::vector<std::string> map;
|
||||
std::vector<Chest> chests;
|
||||
std::vector<Enemy> enemies;
|
||||
std::vector<NPC> npcs;
|
||||
|
||||
bool loadFromFile(const std::string& path);
|
||||
|
||||
void draw(const Point& playerPosition) const;
|
||||
|
||||
bool isWalkable(int x, int y) const;
|
||||
char getTile(int x, int y) const;
|
||||
};
|
||||
Reference in New Issue
Block a user