I have an enemy that spawns randomly within a layer, but I have come across an issue. I have wall objects and I do not want the enemy to spawn inside or near them, is there some way I can set an event that will stop the enemy spawning inside the wall or near it, but keep the random placement I have?
Develop games in your browser. Powerful, performant & highly capable.
Enemy on created, if Enemy is overlapping wall, destroy Enemy, create Enemy at random(x,y)
Would the enemy need to be on the same layer as the object? At the moment my enemy is on layer 1, the wall is on layer 0. I'm guessing this is why it hasn't been working for me?
Nope, layer irrelevant, just if it's touching. Small chance it could be the collision boxes if it's not working, make sure the wall and the enemy have proper collision and that they intersect and that collision is enabled.
I found the problem that was causing the issue. I had the enemy as a solid, which for some reason stopped the destroy event from working. Thanks —