I have the player in my game set up to look in the direction they are moving in. I also wanted to them appear to be "behind" certain background tiles while moving (not just totally hidden), so in the player update
section I included code to identify those background tiles and swap them out for different ones depending on which direction the player enters the tile. (I had originally tried to make this work using draw
like I do when using hide
, but couldn't get that to work.)
if tilename=="Name of the Tile" then
if event.dx<0 then
swap "Person W Name of the Tile"
elseif event.dx>0 then
swap "Person E Name of the Tile"
elseif event.dy>0 then
swap "Person S Name of the Tile"
elseif event.dy<0 then
swap "Person N Name of the Tile"
end
This works for tiles within a room perfectly, but when the tile is on the edge of a room or an exit, when the player appears in the next room the replacement tile (e.g., "Person W Name of the Tile") remains visible, not the usual player directional tile with nothing obscuring it. The player sprite only reappears when the player moves or the idle animation I have set up starts.
Is there a way to force a particular tile to be drawn as the player enters a new room? One issue is that it would have to only happen on specific locations where a player was previously on one of those special "player appears behind stuff" tiles.
Hopefully this makes sense. And maybe I'm just going about this all wrong!