make solid isometric layers

I’m hoping this is easy/possible

I need to make a layer that isnt the sprite layer solid so the player sprite cant pass through it on a isometric map

I’m using the demo code from the IsometricComposer 0v984-7 and have then created a new map in tiled

my map has the following layers

Layer 3 - player sprite

Layer 2 - walls

Layer 1 - ground

if I have the walls and player sprite on the same layer (which I dont want) then the player sprite can not pass through the walls (which I want) with them on different layers the sprite passes straight through.

I have set the layer and tile properties to “solid” and “true” but this just doesnt seem to have any effect when the solid object and sprite are on different layers.

can someone tell me how to fix this???

Your best bet is to contact the author directly.

The collision detection for IsometricComposer is controlled programmatically in scene.lua, in the obstacle() function at line 21. Detection of solid obstacles is handled in lines 34 to 44:

local isSolid = false local isSlopeNext = false local detectNext = mte.getTileProperties({layer = player.layer, locX = locX, locY = locY}) if detectNext then if detectNext.solid then isSolid = true end if detectNext.slope then isSlopeNext = true end end

As you can see, the code retrieves the properties of a tile on layer = player.layer. The simplest way to get the effect you want on the map you describe is to change this to layer = player.layer - 1, or layer = 2 as follows:

local isSolid = false local isSlopeNext = false local detectNext = mte.getTileProperties({layer = player.layer - 1, locX = locX, locY = locY}) if detectNext then if detectNext.solid then isSolid = true end if detectNext.slope then isSlopeNext = true end end

thanks dyson worked perfectly, I’m still trying to get hang of mte and tiled

1 other question, I’m trying to create tiles dynamically in the isometric example

I can remove tiles using

mte.updateTile({locX = 39, locY = 70, layer = 1, tile = 0})

but if I use anything other than 0 for tile it comes up with an error

how do I define a tile so that I can make it appear at the locX/Y of my choosing, I cant see how to define it in tiled??

thanks for any help

Could you post the error here?

Also, is the tile you’re trying to update currently involved in a physics collision? Do you get the same error at map locations with a non-physics tile?

nope I’m not doing any physics collision yet, its just a static tile

the error I’m getting is

c:\users\rj\downloads\million tile engine 0v984-7\million tile engine 0v984-7\sample projects\ isometriccomposer 0v984-7\MTE\mte.lua:4564: attempt to perform arithmetic on field '?' (a nil value) message stack traceback: ?: in function \<?:218\> [C]: ? c:\users\rj\downloads\million tile engine 0v984-7\million tile engine 0v984-7\sample projects\ isometriccomposer 0v984-7\MTE\mte.lua:4564: in function 'updateTile' c:\users\rj\downloads\million tile engine 0v984-7\million tile engine 0v984-7\sample projects\ isometriccomposer 0v984-7\scene.lua:298: in function \<c:\users\rj\downloads\million tile engine 0v984-7\million tile engine 0v984-7\sample projects\ isometriccomposer 0v984-7\scene.lua:277\> ?: in function 'dispatchEvent' ?: in function '\_nextTransition' ?: in function \<?:1439\> ?: in function 'gotoScene' c:\users\rj\downloads\million tile engine 0v984-7\million tile engine 0v984-7\sample projects\ isometriccomposer 0v984-7\main.lua:43: in main chunk

forgot to add, this happens if I use anything other than 0 as the tile such as

mte.updateTile({locX = 37, locY = 52, layer = 3, tile = 48})

Are you calling mte.updateTile() before the first call to mte.update()? If so try adding an mte.update() call above the mte.updateTile() call and see if that has any effect. A lot of the variables MTE uses internally are set or calculated the first time mte.update() executes.

yeap thats it thanks!! :slight_smile:

Your best bet is to contact the author directly.

The collision detection for IsometricComposer is controlled programmatically in scene.lua, in the obstacle() function at line 21. Detection of solid obstacles is handled in lines 34 to 44:

local isSolid = false local isSlopeNext = false local detectNext = mte.getTileProperties({layer = player.layer, locX = locX, locY = locY}) if detectNext then if detectNext.solid then isSolid = true end if detectNext.slope then isSlopeNext = true end end

As you can see, the code retrieves the properties of a tile on layer = player.layer. The simplest way to get the effect you want on the map you describe is to change this to layer = player.layer - 1, or layer = 2 as follows:

local isSolid = false local isSlopeNext = false local detectNext = mte.getTileProperties({layer = player.layer - 1, locX = locX, locY = locY}) if detectNext then if detectNext.solid then isSolid = true end if detectNext.slope then isSlopeNext = true end end

thanks dyson worked perfectly, I’m still trying to get hang of mte and tiled

1 other question, I’m trying to create tiles dynamically in the isometric example

I can remove tiles using

mte.updateTile({locX = 39, locY = 70, layer = 1, tile = 0})

but if I use anything other than 0 for tile it comes up with an error

how do I define a tile so that I can make it appear at the locX/Y of my choosing, I cant see how to define it in tiled??

thanks for any help

Could you post the error here?

Also, is the tile you’re trying to update currently involved in a physics collision? Do you get the same error at map locations with a non-physics tile?

nope I’m not doing any physics collision yet, its just a static tile

the error I’m getting is

c:\users\rj\downloads\million tile engine 0v984-7\million tile engine 0v984-7\sample projects\ isometriccomposer 0v984-7\MTE\mte.lua:4564: attempt to perform arithmetic on field '?' (a nil value) message stack traceback: ?: in function \<?:218\> [C]: ? c:\users\rj\downloads\million tile engine 0v984-7\million tile engine 0v984-7\sample projects\ isometriccomposer 0v984-7\MTE\mte.lua:4564: in function 'updateTile' c:\users\rj\downloads\million tile engine 0v984-7\million tile engine 0v984-7\sample projects\ isometriccomposer 0v984-7\scene.lua:298: in function \<c:\users\rj\downloads\million tile engine 0v984-7\million tile engine 0v984-7\sample projects\ isometriccomposer 0v984-7\scene.lua:277\> ?: in function 'dispatchEvent' ?: in function '\_nextTransition' ?: in function \<?:1439\> ?: in function 'gotoScene' c:\users\rj\downloads\million tile engine 0v984-7\million tile engine 0v984-7\sample projects\ isometriccomposer 0v984-7\main.lua:43: in main chunk

forgot to add, this happens if I use anything other than 0 as the tile such as

mte.updateTile({locX = 37, locY = 52, layer = 3, tile = 48})

Are you calling mte.updateTile() before the first call to mte.update()? If so try adding an mte.update() call above the mte.updateTile() call and see if that has any effect. A lot of the variables MTE uses internally are set or calculated the first time mte.update() executes.

yeap thats it thanks!! :slight_smile: