diff --git a/README.md b/README.md
index 147b001..fd043ad 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,3 @@
# 2D Map
-Простейший пример генерации карты для игр.
\ No newline at end of file
+Простейший пример генерации карты для игр. Добавил пародию на ООП и пофиксил большинство ошибок.
\ No newline at end of file
diff --git a/map.php b/map.php
deleted file mode 100644
index 1cd3872..0000000
--- a/map.php
+++ /dev/null
@@ -1,104 +0,0 @@
-
-error_reporting(E_ALL);
-session_start();
-
-if (!isset($_GET["name"])) $_GET["name"] ="map";
-//Читаем карту
-$handle = fopen(htmlspecialchars($_GET["name"]).".csv", "r");
-while (($data = fgetcsv($handle, 1000, ";")) !== FALSE){
- $map[]=$data;
-}
-fclose($handle);
-//Карта в двухмерном массиве $map
-
-//информация о квадрате
-$infodot["g"]["status"] = "allow";
-$infodot["m"]["status"] = "allow";
-
-if ($_POST['action']=='down' AND $infodot[$map[$_SESSION["y"]+1][$_SESSION["x"]]]["status"]=='allow'){
- $_SESSION["y"]++;
-}
-if ($_POST['action']=='up' AND $infodot[$map[$_SESSION["y"]-1][$_SESSION["x"]]]["status"]=='allow'){
- $_SESSION["y"]--;
-}
-if ($_POST['action']=='left' AND $infodot[$map[$_SESSION["y"]][$_SESSION["x"]-1]]["status"]=='allow'){
- $_SESSION["x"]--;
-}
-if ($_POST['action']=='right' AND $infodot[$map[$_SESSION["y"]][$_SESSION["x"]+1]]["status"]=='allow'){
- $_SESSION["x"]++;
-}
-
-//если первый заход на карту
-if (!isset($_SESSION["y"]) OR !isset($_SESSION["x"])){
- $_SESSION["y"]=5;
- $_SESSION["x"]=5;
-}
-if ($_GET["name"]=="map2") {
- $_SESSION["y"]=4;
- $_SESSION["x"]=2;
-
-}
-
-//Строим квадрат 5Х5 вокруг игрока
-$y = $_SESSION["y"]-2;
-$y_end = $_SESSION["y"]+2;
-$x = $_SESSION["x"]-2;
-$x_end = $_SESSION["x"]+2;
-$q = $x;
-print "
";
-while ($y <= $y_end){
- print "
";
- $x = $q;
- while ($x <= $x_end){
- if (@$map[$y][$x] == ""){ // ползут ошибки!
- $map[$y][$x] = "end";
- }
- if ($y == $_SESSION["y"] AND $x == $_SESSION["x"]){
- print "
";
- print "";
- print "
";
- }
- else{
- print "
";
- print "";
- print "
";
- }
- $x++;
- }
- print "
";
- $y++;
-}
-print "
";
-//квадрат построен
-?>
-
-
-
-
-
-
-
-/*
-//Описываем свойство отдельной клетки с координатами 2,2
-if ($_SESSION["y"] == 2 AND $_SESSION["x"] == 2){
- print "В этой клетке c координатами 2,2 находится магазин";
-}
-else{
- print "В этой клетке нет активных элементов";
-}
-*/
-
-//Описываем свойство целого класса клеток
-if ($map[$_SESSION["y"]][$_SESSION["x"]] == "m"){ print "В этой клетке класса m находится магазин"; }
-
-//Бежим на вторую карту с первой.
-if ($_SESSION["y"] == 2 AND $_SESSION["x"] == 0){
- print "Сменить локацию.";
-}
-
-?>
\ No newline at end of file
diff --git a/mapimg/m-e.png b/mapimg/m-e.png
deleted file mode 100644
index 28372c7..0000000
Binary files a/mapimg/m-e.png and /dev/null differ
diff --git a/mapimg/m-n.png b/mapimg/m-n.png
deleted file mode 100644
index 33fa9d4..0000000
Binary files a/mapimg/m-n.png and /dev/null differ
diff --git a/mapimg/m-s.png b/mapimg/m-s.png
deleted file mode 100644
index 2bdb44e..0000000
Binary files a/mapimg/m-s.png and /dev/null differ
diff --git a/mapimg/m-w.png b/mapimg/m-w.png
deleted file mode 100644
index 508cbfc..0000000
Binary files a/mapimg/m-w.png and /dev/null differ
diff --git a/public/index.php b/public/index.php
new file mode 100644
index 0000000..3acabb5
--- /dev/null
+++ b/public/index.php
@@ -0,0 +1,74 @@
+goUp();
+}
+if ($_POST['action'] === 'down') {
+ $map->goDown();
+}
+if ($_POST['action'] === 'left') {
+ $map->goLeft();
+}
+if ($_POST['action'] === 'right') {
+ $map->goRight();
+}
+if ($_POST['action'] === 'clear') {
+ Player::clear();
+}
+
+/** Для отладки. */
+?>
+
+ P:[= Player::getPos()[0] ?>,= Player::getPos()[1] ?>] MAP:[= $_SESSION['mapname'] ?>]
+ Смена локаций на MAP:[0,2] и MAP2:[4,2]. Да, там надо повторно клацнуть чтобы всё сменилось, но опять же, это
+ принцип на коленке, а не готовое решение. Если хранить всё хоть в какой-то базе, а не в сессиях от половины этих
+ костылей можно отказаться.
+
';
+MapData::drawFullMap();
diff --git a/mapimg/end.png b/resources/img/end.png
similarity index 100%
rename from mapimg/end.png
rename to resources/img/end.png
diff --git a/mapimg/g.png b/resources/img/g.png
similarity index 100%
rename from mapimg/g.png
rename to resources/img/g.png
diff --git a/mapimg/m.png b/resources/img/m.png
similarity index 100%
rename from mapimg/m.png
rename to resources/img/m.png
diff --git a/mapimg/o.png b/resources/img/o.png
similarity index 100%
rename from mapimg/o.png
rename to resources/img/o.png
diff --git a/mapimg/point.gif b/resources/img/point.gif
similarity index 100%
rename from mapimg/point.gif
rename to resources/img/point.gif
diff --git a/mapimg/w.png b/resources/img/w.png
similarity index 100%
rename from mapimg/w.png
rename to resources/img/w.png
diff --git a/mapimg/x.png b/resources/img/x.png
similarity index 100%
rename from mapimg/x.png
rename to resources/img/x.png
diff --git a/map.csv b/resources/maps/map.csv
similarity index 100%
rename from map.csv
rename to resources/maps/map.csv
diff --git a/map2.csv b/resources/maps/map2.csv
similarity index 100%
rename from map2.csv
rename to resources/maps/map2.csv
diff --git a/resources/views/map-controls.html b/resources/views/map-controls.html
new file mode 100644
index 0000000..b779688
--- /dev/null
+++ b/resources/views/map-controls.html
@@ -0,0 +1,43 @@
+
+
+