Awesome-Game-Team / Awesome-Game

An Awesome Game
GNU General Public License v3.0
8 stars 9 forks source link

Error after editing map in Tiled #12

Closed jimfrize closed 8 years ago

jimfrize commented 8 years ago

I cant seem to edit the maps on my system using Tiled, the resulting .JSON file stops the game from running and it throws an error. I've asked a question on the Tiled community forum to see if they know anything about it:

http://discourse.mapeditor.org/t/typemismatcherror-after-editing-map/1366

metalx1000 commented 8 years ago

@jimfrize So, you can open and edit the map, and exporting seems to go alright (no errors at that point). But the generated file fails?

Just to be clear, you are trying open and edit the "Test_v2.tmx" file I made?

jimfrize commented 8 years ago

@metalx1000 That's all correct

metalx1000 commented 8 years ago

Can you post both your saved tmx file and the json output file some place so I can see them?

jimfrize commented 8 years ago

It seems I can save out new maps with different platforms and layouts, but I get the problem again if I try to add a jetpack. I have added a single jetpack at the beginning of the level: map.zip

jimfrize commented 8 years ago

@metalx1000 Still looking into this, just making small changes to the map and seeing when things break. I've got some new objects and background images ready to go, just need to work this Tiled thing out and I can make a pull request. I'm currently looking into the .JS files and working out how to preload images and stuff. Hold tight!

metalx1000 commented 8 years ago

Here is the tutorial I used when learning how to design tile maps: https://gamedevacademy.org/html5-phaser-tutorial-top-down-games-with-tiled/

The map you created worked for me, but here are a few things: 1) Seems like my browser had cached the old "map.json", clear the cache for that file after making changes. 2) The Jet pack needs to be added to "objects" layer, and "type" in the properties tab on the left needs to be set to "jetpack".

Our code searches through the map.json file's object layer, and get's the position for all objects with "jetpack" as their type and uses those positions to place/create jetpack objects.

jimfrize commented 8 years ago

@metalx1000 thanks! I'll have a look at that tut later :)

I don't have to worry about the cached version, the bookmark I have stored has a suffix in the url to stop that:

http://jimjim.local/Awesome-Game/?nocache=1

So whenever the page loads it ignores the cache.

jimfrize commented 8 years ago

Ok, finally worked out what was wrong, I was adding the jetpacks to the world layer - doh! I've got it sorted now :)