I want an enemy that can’t pass through walls, but can pass through the player. But the player also can’t pass through walls. Not sure how to make any of this work.
How does you enemy work?
I feel like the specifics shouldn’t matter, just wondering if it’s possible to keep the physical property for specific object interactions.
You could test with the enable and disable.
For your game you could make the enemies ‘ghosts’ and whenever they raycast a wall they turn around and move the other way.
Ray-casting very lag heavy, trying not to create lag as much as possible.
ray cats don’t have that much lag
no, flowlab doesn’t have layered collisions, although it has been a wanted feature for a long time. There are many work-arounds though. They will all require a bit of extra lag… You won’t be able to notice it.
I’d love to hear these work arounds. This is my first non tower defense game. So physics is something i’ve never dealt with.
protip: if you are telling someone that something can be done, be prepared to know how to do it before you say anything.
1: The best workaround would probably be to put out a bunch of raycasters for the enemy and the player, scanning for walls. Two raycasts for each direction, probably. Then you can just turn off movement in that direction. This would look sommthinnngggg like this:
(for one direction.)
Or you could do a more advanced version of the same thing and use proximity (probably better for lag.)
I can make it for you if you want.
2: For a glitchier and simpler workaround, you can do @Kasamir’s idea, with the enabled block. Keep in mind that with this, the player can basicly phase through blocks whenever an enemy is on top of it. And the movement also has to be done with position, not velocity.
3: Just use collisions to turn the enemy away when it hits the wall
My game is top down, so in theory i’m replicating the Zelda mechanics. Link can pass through enemies but not walls. Not sure if 360 degree changes anything.
Yes, these are both for top-down
So the requirments are…
- The player has to pass through the enemy
- The enemy cant go through walls
- The player cant go through walls
Right?
Here you go;
Hope it works for you.
um yeah, this is a VERY simple enemy though. It wont work for a lot of things but yeah…
Yeah, but I was hoping it work for this particular game.
Do you think, if there was any shooting or much action of an enemy like this it would mess the whole thing up?
Shooting wouldn’t make it mess up, but any interesting movement targeting the player probably would.
Why would this mess it up?, I don’t think the movement effects anything.
Thanks for this, but i’m a little confused how i’m supposed to use an enemy that targets the player with this, since it wouldn’t collide with the walls.