Is there a way to allow sprites to go through tilemap walls whilst also being able to have collisions? This could be useful if had an enemy ghost, which could go through the tilemap walls while the player couldn’t but could deal damage to the player.
I was thinking of setting the ghost’s ghost flag to true and checking the distance between the player and the ghost and if was less than like 16 or something that would count as a “collision”.
Idea…
No walls and make the player move backward if they touch a ‘wall’
Or make some code to make it a wall only if the player is near it
But yes your idea would be cooler
And easier
That is a good idea, but the player would be able to walk halfway into a wall before I detect the tile overlap and push him back. My game also relies on the pathfinding extension which relies on walls too…
I had the same sort of issue while making Frogging Fun. I wanted the cars and logs to overlap with the player, but still be able to move through the walls. That way it gives the appearance of leaving the tilemap. If that were possible, I don’t think there is a way of locating the sprite outside the tilemap. As you mention, you could make the sprite a ghost so that it leaves, but then it doesn’t overlap the player.
My solution was to add an extra column where the player may not move over, so that it looks like the enemy leaves the screen, when in fact it just stops at the wall. I use a on hit wall event to add the sprite to an array, and then a game update interval event to put the wall hitting sprites back to other side.
I think that is reasonable to assume. The current sprite collision detection does take into account not overlapping transparent pixels, but if your sprites are all the same size and occupy most of the 16x16 space, then that shouldn’t be an issue.
Yeah, they are all 16x16 and they mostly take up the whole space. Hopefully, the player won’t notice the fact they are taking damage even though the ghost is really close but not touching. The ghosts deal lots of damage and should provide a good distraction.
They should also add a distance function, like distance between [sprite] and [sprite] in pixels. Those functions are humongous in blocks.
Jacob made an interesting video explaining the distance between the two sprites, and I’m sure you know how to calculate it. What I didn’t know, is that you can have a block function return a value if you use the
‘beta’ version of the editor. I hope they incorporate that into the main editor, as returning values is essential.
It’s been on our todo list for a while to separate out a flag for ghost collisions and ghost tilemap collisions. I’ll try and get it into the next release if I have time