Hi, I have two question.how do I use the light texture. I want a square light object and tried making a black square in piskel but the texture is still round. Am I using it wrong or is my gdevelop version corrupted. And one more question how do I make a pathfinding enemy follow the player if it can see the player. Like if the player is close the the enemy and there is no walls in between them
I think if you make a square sprite object with “Light Obstacle” behavior and trap your light inside it, it will be like a square light.
The other question is a bit trickier… or if there’s a simple solution I can’t see it. Maybe with raycasting?
Tried raycast, but did not work. I might be using it wrong
Can I not use the texture feature? I want it be lighting up a whole room
You can try adding light obstacle behavior to the walls or background of the room.
raycasting on its own won’t be enough. You’d also need a condition for when walls are in the way, perhaps raycast to the player to determine distance and also destroy the sensor on collision with walls. Stop the enemy unless the distance is low enough and no walls in the way.
My walls do have the light obstacle behaviour. I mean I want the light to be textured like a square so the light will be the size of a room. You could say like among us where if you enter the room it is lighted up evenly but the other rooms would be dark.
You could try a transparent sprite with light obstacle behavior on top of the room.
Ya, that might work. thanks, now I get it. I will try it and tell you what happens.
But, will it add shadow to the player like a light object will?
Maybe try with smaller lights in the corners of the room rather than a larger light in the center?
Ya, but somehow the light does not emit when I put it in the walls, maybe a bug?
I don’t think it’s a bug, it’s because your walls have light obstacle behavior so they are trapping the light… you could try putting them just outside the corners but still inside the room
Let me try that and let you know what happens
i suggest to add object variable of enemy named like “spot”, and change the value to 1 if character is closer than x pixels to enemy. Another event with condition if enemy and character are further than x pixels change the object variable “spot” of enemy to 0 (on both events add the condition trigger once).
Then, add an event with condition: if object variable “spot” of enemy is 1 and emitter a raycast from enemy to Character, a child event with condition: number of objects “character” >0, and an action on that child event with: move the enemy to character (beware if you use just move the enemy or pathfinding). This event must activate every time those conditions are met to move constantly, so don’t use trigger once on it.