diff --git a/resources/public/map/map-2layers.tmx b/resources/public/map/map-2layers.tmx new file mode 100644 index 0000000..00a209d --- /dev/null +++ b/resources/public/map/map-2layers.tmx @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,43,43,42,43,43, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,41,43,41,41,42, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,42,41,43,42,42, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2,3,3,2,2,3,2,2,2,3,1,2,2,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,3,2,3,2,2,2,3,3,2,1,2,2,2,1, +1,1,1,1,1,2,2,2,1,1,1,1,1,1,2,3,3,1,1,1,1,1,2,3,3,1,3,1,3,2, +1,1,1,1,1,3,2,3,1,1,1,1,1,1,2,2,3,1,1,1,1,1,3,1,2,1,3,2,3,3, +1,1,1,1,1,2,3,2,1,1,1,1,1,1,3,2,3,1,1,1,1,1,3,3,3,1,3,1,2,3, +1,1,1,1,1,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,2,1, +1,1,1,1,1,2,3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,3,3,1,3,1, +1,1,1,1,1,2,3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2,1,2,2,1, +1,1,1,1,1,3,3,3,3,3,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,2,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,2,2,2,3,3,3,3,3,2,3,2,2,3,3,2,3,2,2,3,2,2,3,2,3,3, +1,1,1,1,1,2,2,2,2,2,3,2,3,3,3,2,3,3,2,3,2,2,2,3,3,2,3,3,2,3, +1,1,1,1,1,3,3,3,2,2,3,2,2,2,2,3,3,3,2,2,3,2,3,2,2,3,3,3,1,1, +1,1,1,1,1,3,3,2,3,3,2,3,3,3,2,3,3,3,2,3,3,3,2,2,2,1,2,1,2,3, +1,1,1,1,1,2,3,2,3,2,3,2,3,2,2,3,3,2,2,3,3,2,2,2,3,1,1,2,3,3, +1,2,2,1,1,3,2,3,3,2,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,3,2,3, +3,3,2,3,1,1,3,3,2,2,2,3,2,3,2,3,2,3,2,2,3,1,2,2,3,3,2,2,3,2, +3,1,2,2,1,2,2,2,3,3,2,1,1,2,3,2,3,3,2,2,3,2,1,2,3,2,2,3,3,2, +3,2,2,2,1,2,3,3,2,3,2,2,2,2,3,3,2,3,3,2,3,2,2,3,2,2,2,2,1,3, +2,1,2,2,1,1,3,2,3,3,2,3,2,3,3,3,2,2,3,2,3,2,3,2,1,1,3,2,2,3 + + + + +42,41,43,41,42,43,43,41,41,41,42,43,43,41,42,41,43,41,42,43,43,43,42,42,41,0,0,0,0,0, +43,41,41,42,41,41,43,42,41,41,41,41,41,42,43,42,41,42,42,43,43,41,41,42,41,0,0,0,0,0, +41,43,41,42,41,41,43,41,43,42,43,42,41,42,43,42,43,43,41,41,41,43,43,42,42,0,0,0,0,0, +41,42,42,42,41,43,43,41,42,42,41,43,43,82,82,82,82,82,81,82,81,81,82,81,82,0,0,0,42,43, +43,43,43,43,43,42,43,43,43,43,41,42,43,81,337,338,339,0,0,52,0,10,11,82,81,0,0,43,43,41, +43,43,41,41,81,82,82,82,82,43,43,42,41,81,0,0,0,0,0,0,52,50,51,81,10,11,0,0,42,41, +42,43,41,43,82,0,0,0,82,43,43,43,41,82,0,0,0,486,487,488,489,490,82,82,50,51,0,0,0,0, +42,43,42,43,81,0,0,0,82,42,43,42,41,82,0,0,0,526,527,528,529,530,7,8,9,10,11,0,0,0, +41,42,43,42,81,0,0,0,81,43,42,41,42,82,615,615,615,566,567,568,569,570,47,48,49,50,51,0,0,0, +42,42,42,43,82,0,0,0,81,41,43,41,43,82,0,0,0,0,328,334,335,336,0,0,0,573,0,0,0,0, +42,42,43,43,81,0,0,0,81,43,43,41,43,82,0,780,0,0,328,0,0,0,0,0,0,573,0,0,0,0, +82,82,81,82,82,0,0,0,82,81,82,82,698,82,0,0,0,0,328,0,0,0,0,0,0,613,615,615,615,615, +0,0,3,0,0,0,0,0,0,0,0,0,328,0,0,0,0,0,328,0,0,0,0,0,0,0,0,0,0,0, +367,367,367,367,367,367,367,367,367,367,367,367,368,367,367,367,367,367,368,369,369,369,369,369,369,367,367,367,367,367, +3,0,0,3,0,0,0,0,0,0,0,0,408,583,587,587,587,453,454,455,456,587,0,0,0,0,0,0,0,0, +81,82,81,82,82,0,0,0,0,0,0,0,408,626,166,0,0,493,494,495,496,625,0,0,0,10,11,7,8,9, +2,2,2,2,82,0,0,0,0,0,0,0,408,626,0,0,0,533,534,535,536,625,0,0,0,50,51,47,48,49, +2,3,3,2,82,0,0,0,0,0,0,0,407,369,369,369,369,369,409,0,0,625,0,0,0,10,11,0,0,0, +3,2,3,0,81,0,0,0,0,0,0,0,0,666,664,664,664,664,664,664,664,665,0,0,0,50,51,0,0,0, +0,0,0,0,81,7,8,9,10,11,7,8,9,7,8,9,10,11,7,8,9,10,11,7,8,9,0,0,0,0, +0,0,0,0,81,47,48,49,50,51,47,48,49,47,48,49,50,51,47,48,49,50,51,47,48,49,0,0,0,0, +0,0,0,0,81,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,81,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,82,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/public/map/map.tmx b/resources/public/map/map-3layers.tmx similarity index 100% rename from resources/public/map/map.tmx rename to resources/public/map/map-3layers.tmx diff --git a/resources/public/map/map.json b/resources/public/map/map.json index 7fdbadb..0aedf1e 100644 --- a/resources/public/map/map.json +++ b/resources/public/map/map.json @@ -14,21 +14,9 @@ "y":0 }, { - "data":[42, 41, 43, 41, 42, 43, 43, 41, 41, 41, 42, 43, 43, 41, 42, 41, 43, 41, 42, 43, 43, 43, 42, 42, 41, 0, 0, 0, 0, 0, 43, 41, 41, 42, 41, 41, 43, 42, 41, 41, 41, 41, 41, 42, 43, 42, 41, 42, 42, 43, 43, 41, 41, 42, 41, 0, 0, 0, 0, 0, 41, 43, 41, 42, 41, 41, 43, 41, 43, 42, 43, 42, 41, 42, 43, 42, 43, 43, 41, 41, 41, 43, 43, 42, 42, 0, 0, 0, 0, 0, 41, 42, 42, 42, 41, 43, 43, 41, 42, 42, 41, 43, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 43, 43, 43, 43, 42, 43, 43, 43, 43, 41, 42, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 43, 41, 41, 0, 0, 0, 0, 0, 43, 43, 42, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 43, 41, 43, 0, 0, 0, 0, 0, 43, 43, 43, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 43, 42, 43, 0, 0, 0, 0, 0, 42, 43, 42, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, 42, 0, 0, 0, 0, 0, 43, 42, 41, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 42, 43, 0, 0, 0, 0, 0, 41, 43, 41, 43, 0, 0, 0, 0, 0, 328, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 43, 43, 0, 0, 0, 0, 0, 43, 43, 41, 43, 0, 0, 0, 0, 0, 328, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 698, 0, 0, 0, 0, 0, 328, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 328, 0, 0, 0, 0, 0, 328, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 368, 367, 367, 367, 367, 367, 368, 369, 369, 369, 369, 369, 369, 367, 367, 367, 367, 367, 3, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 408, 0, 0, 0, 0, 584, 0, 0, 584, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 408, 626, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 408, 626, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 407, 369, 369, 369, 369, 369, 409, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 666, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "data":[42, 41, 43, 41, 42, 43, 43, 41, 41, 41, 42, 43, 43, 41, 42, 41, 43, 41, 42, 43, 43, 43, 42, 42, 41, 0, 0, 0, 0, 0, 43, 41, 41, 42, 41, 41, 43, 42, 41, 41, 41, 41, 41, 42, 43, 42, 41, 42, 42, 43, 43, 41, 41, 42, 41, 0, 0, 0, 0, 0, 41, 43, 41, 42, 41, 41, 43, 41, 43, 42, 43, 42, 41, 42, 43, 42, 43, 43, 41, 41, 41, 43, 43, 42, 42, 0, 0, 0, 0, 0, 41, 42, 42, 42, 41, 43, 43, 41, 42, 42, 41, 43, 43, 82, 82, 82, 82, 82, 81, 82, 81, 81, 82, 81, 82, 0, 0, 0, 42, 43, 43, 43, 43, 43, 43, 42, 43, 43, 43, 43, 41, 42, 43, 81, 337, 338, 339, 0, 0, 52, 0, 10, 11, 82, 81, 0, 0, 43, 43, 41, 43, 43, 41, 41, 81, 82, 82, 82, 82, 43, 43, 42, 41, 81, 0, 0, 0, 0, 0, 0, 52, 50, 51, 81, 10, 11, 0, 0, 42, 41, 42, 43, 41, 43, 82, 0, 0, 0, 82, 43, 43, 43, 41, 82, 0, 0, 0, 486, 487, 488, 489, 490, 82, 82, 50, 51, 0, 0, 0, 0, 42, 43, 42, 43, 81, 0, 0, 0, 82, 42, 43, 42, 41, 82, 0, 0, 0, 526, 527, 528, 529, 530, 7, 8, 9, 10, 11, 0, 0, 0, 41, 42, 43, 42, 81, 0, 0, 0, 81, 43, 42, 41, 42, 82, 615, 615, 615, 566, 567, 568, 569, 570, 47, 48, 49, 50, 51, 0, 0, 0, 42, 42, 42, 43, 82, 0, 0, 0, 81, 41, 43, 41, 43, 82, 0, 0, 0, 0, 328, 334, 335, 336, 0, 0, 0, 573, 0, 0, 0, 0, 42, 42, 43, 43, 81, 0, 0, 0, 81, 43, 43, 41, 43, 82, 0, 780, 0, 0, 328, 0, 0, 0, 0, 0, 0, 573, 0, 0, 0, 0, 82, 82, 81, 82, 82, 0, 0, 0, 82, 81, 82, 82, 698, 82, 0, 0, 0, 0, 328, 0, 0, 0, 0, 0, 0, 613, 615, 615, 615, 615, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 328, 0, 0, 0, 0, 0, 328, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 368, 367, 367, 367, 367, 367, 368, 369, 369, 369, 369, 369, 369, 367, 367, 367, 367, 367, 3, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 408, 583, 587, 587, 587, 453, 454, 455, 456, 587, 0, 0, 0, 0, 0, 0, 0, 0, 81, 82, 81, 82, 82, 0, 0, 0, 0, 0, 0, 0, 408, 626, 166, 0, 0, 493, 494, 495, 496, 625, 0, 0, 0, 10, 11, 7, 8, 9, 2, 2, 2, 2, 82, 0, 0, 0, 0, 0, 0, 0, 408, 626, 0, 0, 0, 533, 534, 535, 536, 625, 0, 0, 0, 50, 51, 47, 48, 49, 2, 3, 3, 2, 82, 0, 0, 0, 0, 0, 0, 0, 407, 369, 369, 369, 369, 369, 409, 0, 0, 625, 0, 0, 0, 10, 11, 0, 0, 0, 3, 2, 3, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 666, 664, 664, 664, 664, 664, 664, 664, 665, 0, 0, 0, 50, 51, 0, 0, 0, 0, 0, 0, 0, 81, 7, 8, 9, 10, 11, 7, 8, 9, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 81, 47, 48, 49, 50, 51, 47, 48, 49, 47, 48, 49, 50, 51, 47, 48, 49, 50, 51, 47, 48, 49, 0, 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "height":24, - "id":23, - "name":"Dekoration", - "opacity":1, - "type":"tilelayer", - "visible":true, - "width":30, - "x":0, - "y":0 - }, - { - "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, 82, 82, 82, 82, 81, 82, 81, 81, 82, 81, 82, 0, 0, 0, 42, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 337, 338, 339, 0, 0, 52, 0, 10, 11, 82, 81, 0, 0, 43, 43, 41, 0, 0, 0, 0, 81, 82, 82, 82, 82, 0, 0, 0, 0, 81, 0, 0, 0, 0, 0, 0, 52, 50, 51, 81, 10, 11, 0, 0, 42, 41, 0, 0, 0, 0, 82, 0, 0, 0, 82, 0, 0, 0, 0, 82, 0, 0, 0, 486, 487, 488, 489, 490, 82, 82, 50, 51, 0, 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, 82, 0, 0, 0, 0, 82, 0, 0, 0, 526, 527, 528, 529, 530, 7, 8, 9, 10, 11, 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, 81, 0, 0, 0, 0, 82, 615, 615, 615, 566, 567, 568, 569, 570, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, 0, 81, 0, 0, 0, 0, 82, 0, 0, 0, 0, 0, 334, 335, 336, 0, 0, 0, 573, 0, 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, 81, 0, 0, 0, 0, 82, 0, 780, 0, 0, 0, 0, 0, 0, 0, 0, 0, 573, 0, 0, 0, 0, 82, 82, 81, 82, 82, 0, 0, 0, 82, 81, 82, 82, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 613, 615, 615, 615, 615, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 583, 587, 587, 587, 453, 454, 455, 456, 587, 0, 0, 0, 0, 0, 0, 0, 0, 81, 82, 81, 82, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 166, 0, 0, 493, 494, 495, 496, 625, 0, 0, 0, 10, 11, 7, 8, 9, 0, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 533, 534, 535, 536, 625, 0, 0, 0, 50, 51, 47, 48, 49, 0, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 625, 0, 0, 0, 10, 11, 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 664, 664, 664, 664, 664, 664, 664, 665, 0, 0, 0, 50, 51, 0, 0, 0, 0, 0, 0, 0, 81, 7, 8, 9, 10, 11, 7, 8, 9, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 81, 47, 48, 49, 50, 51, 47, 48, 49, 47, 48, 49, 50, 51, 47, 48, 49, 50, 51, 47, 48, 49, 0, 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - "height":24, - "id":24, + "id":25, "name":"Vordergrund", "opacity":1, "type":"tilelayer", @@ -224,7 +212,7 @@ "x":0, "y":0 }], - "nextlayerid":25, + "nextlayerid":26, "nextobjectid":62, "orientation":"orthogonal", "renderorder":"right-down", diff --git a/src/cljs/topdown2d/demoscene.cljs b/src/cljs/topdown2d/demoscene.cljs index 92c793d..09ad5b3 100644 --- a/src/cljs/topdown2d/demoscene.cljs +++ b/src/cljs/topdown2d/demoscene.cljs @@ -19,6 +19,7 @@ :zoom 3} :player {:x (- (/ (get-in gamestate [:dimensions :w]) 2) 32) :y (- (/ (get-in gamestate [:dimensions :h]) 2) 32) + :w 0 :h 0 :d :s :animation {:ids {:s 778 :n 778 :e 819 :w 819} @@ -28,7 +29,7 @@ :viewport {:keep-in {:x 0 :y 0 :w 0 :h 0} :tileset :pokelike - :x (* 16 6 3) :y (* 16 9 3) + :x 6 :y 9 :w (get-in gamestate [:dimensions :w]) :h (get-in gamestate [:dimensions :h]) :d :? @@ -54,13 +55,19 @@ (if (and (not (get-in scenestate [:map-def :def])) (some? @map-def)) (let [loaded-def (walk/keywordize-keys @map-def) - zoom (get-in scenestate [:map-def :zoom])] + zoom (get-in scenestate [:map-def :zoom]) + {mw :width mh :height + tw :tilewidth th :tileheight} loaded-def] (-> scenestate (assoc-in [:map-def :def] loaded-def) (update-in [:map-def :def] (partial tileset/prepare-map-def zoom)) - (assoc-in [:viewport :keep-in :w] (* (dec (:width loaded-def)) 3 16)) - (assoc-in [:viewport :keep-in :h] (* (dec (:height loaded-def)) 3 16)))) + (assoc-in [:viewport :keep-in :w] (* (dec mw) zoom tw)) + (assoc-in [:viewport :keep-in :h] (* (dec mh) zoom th)) + (update-in [:viewport :x] * tw zoom) + (update-in [:viewport :y] * th zoom) + (assoc-in [:player :w] (- tw 2)) + (assoc-in [:player :h] (- th 2)))) scenestate)) (defn update-scene [gamestate scenestate] @@ -68,7 +75,6 @@ player (:player new-scenestate) viewport (:viewport new-scenestate) dir (get-in gamestate [:input :dir])] - (println viewport) (assoc new-scenestate :player (update-player gamestate player dir) :viewport (update-viewport gamestate viewport dir))))