diff --git a/README.md b/README.md index fb671ae..147b001 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ -# Template +# 2D Map +Простейший пример генерации карты для игр. \ No newline at end of file diff --git a/map.csv b/map.csv new file mode 100644 index 0000000..0f2a8ac --- /dev/null +++ b/map.csv @@ -0,0 +1,20 @@ +x;w;x;w;w;w;x;w;w;w;w;w;w;w;w;w;w;w;w;g;w;x;x;x;x;x;x;x;x;x;x;x;x;x;x;x;x;g;x;x; +x;x;x;w;x;x;x;x;g;g;g;g;g;g;g;g;g;w;g;g;g;g;g;g;g;x;x;x;g;g;g;g;x;x;x;g;g;g;g;x; +g;g;x;w;w;x;g;x;g;w;w;w;w;g;w;w;g;g;g;w;w;w;w;w;g;g;g;g;g;w;w;g;x;x;x;g;w;w;g;x; +x;g;x;w;m;x;g;g;g;g;g;g;w;g;w;g;g;w;g;g;g;g;g;w;w;g;w;g;w;w;g;g;g;g;g;g;g;w;g;w; +x;g;g;g;g;x;x;g;o;o;g;w;w;w;w;g;w;w;g;w;g;w;w;w;w;w;w;w;w;w;w;w;g;w;w;w;w;w;w;w; +x;x;g;x;g;g;g;g;g;o;g;w;g;w;w;w;w;w;g;w;g;g;g;w;g;w;g;w;g;w;g;w;g;w;g;g;g;g;w;w; +x;x;x;x;g;o;o;o;o;o;g;g;g;g;g;w;g;w;w;w;w;w;w;w;g;w;g;g;g;w;g;w;g;w;w;g;w;w;w;w; +g;g;g;g;g;g;g;g;g;o;o;g;o;o;g;g;g;g;g;w;g;w;g;w;g;w;g;w;w;w;g;w;g;g;g;g;g;w;x;w; +x;x;x;x;x;g;o;g;o;o;o;g;o;o;o;g;w;w;w;w;g;w;g;g;g;g;g;g;g;w;g;w;g;w;w;w;w;w;w;x; +x;g;x;g;g;g;o;o;o;g;o;g;g;g;o;g;w;g;w;w;g;g;g;w;w;w;w;w;g;g;g;g;g;w;g;g;g;g;g;g; +g;g;g;g;x;g;g;g;o;g;o;o;g;o;o;g;g;g;g;g;g;w;w;w;w;g;w;w;w;w;w;w;w;w;g;o;o;o;o;o; +x;x;x;g;x;g;o;o;o;g;g;o;g;o;o;o;o;o;o;o;g;g;g;g;g;g;g;g;g;g;g;g;g;g;g;g;g;o;o;w; +x;g;g;g;x;g;g;g;g;g;o;o;g;g;g;g;g;g;o;g;g;o;o;o;o;o;g;g;o;o;o;o;o;o;o;o;o;o;o;w; +x;x;g;x;x;x;g;o;g;o;o;o;o;o;o;o;o;g;o;o;g;g;g;g;g;o;g;g;g;g;g;g;g;g;g;g;g;o;g;o; +x;x;x;x;g;x;g;o;o;o;o;g;o;o;g;g;o;g;o;g;g;o;g;o;o;o;g;g;o;o;o;o;o;g;o;o;o;o;g;g; +x;x;g;g;g;g;g;g;o;g;g;g;g;g;g;o;o;o;o;g;o;o;g;g;g;o;g;g;o;x;x;x;o;g;g;g;g;g;g;o; +x;m;g;x;g;x;x;g;g;g;x;g;o;o;o;o;o;g;g;g;o;o;g;g;g;o;g;g;o;x;m;o;o;g;o;g;o;o;o;o; +x;x;g;x;g;x;x;g;x;g;x;g;g;g;g;g;o;g;o;o;o;o;g;o;o;o;g;g;o;x;x;x;o;g;o;g;o;g;g;g; +x;x;m;x;x;x;x;g;x;g;x;x;x;o;o;o;o;g;o;o;o;o;o;o;o;o;g;g;o;o;x;o;o;o;o;g;g;g;o;o; +x;x;x;x;x;x;x;x;x;x;x;x;x;x;x;x;o;o;o;o;o;o;o;o;o;o;g;g;o;o;o;o;o;o;o;g;o;o;o;o; \ No newline at end of file diff --git a/map.php b/map.php new file mode 100644 index 0000000..1cd3872 --- /dev/null +++ b/map.php @@ -0,0 +1,104 @@ +"; +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 ""; +//квадрат построен +?> +
+        
+ +
+         +
+    
+ +
+    

+ +В этой клетке 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/map2.csv b/map2.csv new file mode 100644 index 0000000..af816c0 --- /dev/null +++ b/map2.csv @@ -0,0 +1,7 @@ +x;x;x;x;x +x;m;w;w;x +x;g;w;g;g +x;g;w;g;x +x;g;g;g;x +x;w;g;g;x +x;x;x;x;x diff --git a/mapimg/end.png b/mapimg/end.png new file mode 100644 index 0000000..68e1005 Binary files /dev/null and b/mapimg/end.png differ diff --git a/mapimg/g.png b/mapimg/g.png new file mode 100644 index 0000000..5f70678 Binary files /dev/null and b/mapimg/g.png differ diff --git a/mapimg/m-e.png b/mapimg/m-e.png new file mode 100644 index 0000000..28372c7 Binary files /dev/null and b/mapimg/m-e.png differ diff --git a/mapimg/m-n.png b/mapimg/m-n.png new file mode 100644 index 0000000..33fa9d4 Binary files /dev/null and b/mapimg/m-n.png differ diff --git a/mapimg/m-s.png b/mapimg/m-s.png new file mode 100644 index 0000000..2bdb44e Binary files /dev/null and b/mapimg/m-s.png differ diff --git a/mapimg/m-w.png b/mapimg/m-w.png new file mode 100644 index 0000000..508cbfc Binary files /dev/null and b/mapimg/m-w.png differ diff --git a/mapimg/m.png b/mapimg/m.png new file mode 100644 index 0000000..47f0f2d Binary files /dev/null and b/mapimg/m.png differ diff --git a/mapimg/o.png b/mapimg/o.png new file mode 100644 index 0000000..e3a46e1 Binary files /dev/null and b/mapimg/o.png differ diff --git a/mapimg/point.gif b/mapimg/point.gif new file mode 100644 index 0000000..c325f48 Binary files /dev/null and b/mapimg/point.gif differ diff --git a/mapimg/w.png b/mapimg/w.png new file mode 100644 index 0000000..f94a28d Binary files /dev/null and b/mapimg/w.png differ diff --git a/mapimg/x.png b/mapimg/x.png new file mode 100644 index 0000000..9feafc5 Binary files /dev/null and b/mapimg/x.png differ diff --git a/showmap.php b/showmap.php new file mode 100644 index 0000000..879d51b --- /dev/null +++ b/showmap.php @@ -0,0 +1,103 @@ +"; +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 ""; +//квадрат построен +/* +?> + +    
+ +
+    

+ +В этой клетке c координатами 2,2 находится магазин"; +} +else{ + print "В этой клетке нет активных элементов"; +} +*/ + +//Описываем свойство целого класса клеток +/* +if ($map[$_SESSION["y"]][$_SESSION["x"]] == "m"){ + print "В этой клетке класса m находится магазин"; +} +*/ +?> \ No newline at end of file