Hello guys, I’m trying to make a 2d dungeon crawler but I’m having some trouble with the player being able to see through walls and seeing enemies on the other side. I’ve tried using a light object to follow the player and if it comes in collision with an enemy it changes the ememy’s opacity from 0 to 255, but then I noticed that even though it was showing that the light wasnt going through the walls it still changed the opacity of the enemies to 255 if the player was close enough to the enemy through a wall. The game has randomly generated rooms and hallways that connect to eachother, so I’m not able to place things in the scene, everything is generated in the events and placed randomly.
I’m trying to make it where the player can only see enemies if they are at a certain distance AND if there are no walls between the players line of sight. I’ve tried using raycasting since the light thing didn’t work, but I have no idea what I’m doing wrong. I’ve tried looking at other people’s posts regarding that same topic, but I can’t figure out how to use the raycasting to:
- pick an object it sees
- Change the opacity of picked object if it’s an IceElemental
- If it picks a wall, then don’t show the IceElemental
I have the IceElemental and the Wall in the same group too if that helps
I’m very confused and would appreciate any and all help