Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]

Qiso: Problems with new Tiled lua map
Started by d.mach May 14 2019 03:34 AM

1 reply to this topic
qiso tiled problem
[TOPIC: post.html]


[GLOBAL: userInfoPane.html]
  • Contributor

  • 967 posts
  • Corona SDK

I have tried the qiso sample project, added a character (wizard) and was able to click on a tile with the character moving to the tile avoiding all walls and objects BUT now I have loaded the tiled map to TILED then exported a lua map and was using this one instead with the result the character now is moving through walls! Somehow the object recognition and walls are messed up now.


Any help welcome!


[TOPIC: post.html]


[GLOBAL: userInfoPane.html]
  • Contributor

  • 551 posts
  • Corona SDK

Within Tiled, the 4th icon under the tileset thumbnails should be "edit tileset". Click into this, and you should see a grid of tiles on the right, and a list of properties on the left.


Qiso uses per-sprite custom properties to determine which sprites can/can't be walked through, from each individual direction.


Ref https://qiso.qweb.co.uk/documentation/data/map-handling/functions/loadtiledmap for the full list of properties, but for example say your sprite is of a wall along the south east edge of the tile. You should be able to walk through the tile from south west to north east for example, but you shouldn't be able to walk on/off that tile through the south east direction, because that's the wall part.


So click the tile with a south east wall and add a custom property of "disable-path-south-east".


You can hold ctrl to click multiple sprites and set their properties in bulk, and sprites can contain multiple custom properties. So a wall along the south east and a wall along the south west would be a sprite you want to use disable-path-south-east, disable-path-south, and disable-path-south-west on.


What I do is work clockwise. Select all tiles where you need to disable north, and do so. Then select all tiles where you need to disable north east and do that. Keep going until you're out of properties, and you're done.


You can then make any map you like, comprising those sprites, and when exported, Qiso's loadTiledMap() function will do all of the magic for you.


You can also call enablePath() and disablePath() manually if need be. Useful for dynamic events, but frankly convoluted when setting up an initial scene.


Note that this also works when changing tiles in a map. I.e. if using addToTile() and removeFromTile() to build walls for example (isometric Sims game anybody?), that tile will adjust itself accordingly for path-finding.


Does this all make sense?


Also tagged with one or more of these keywords: qiso, tiled, problem