Mutiple guards and other thingy detection sytem

im making a stealth game and i was trying to make it so that when you step into a range (hitbox) of the guard it slowly raises detection but the levels need multiple guards and i dont know how to do that many detections without having a bunch of variable is there any way i can use a array or smth

5 Likes

could you maybe share the code? I could possibly try and help you if you do

So your asking that the more guards that see you at the same time, the more detection will increase?

You could use sprite data, have a number attached to each sprite for detection

I made a guard engine Prototype, and I’m working on getting multiple at once to work

This is what I’ve got for now: The Prototype

You can use the “for element (value) of (list)” block with (list) replaced with “all sprites of kind <guard type>” to loop through every guard. then move all your current guard code inside that loop and replace the guard variable with (value)

I would also recommend using the vision extension to stop the guards from seeing through walls (and add a visible vision range if you want to)

thats the thing i dont have the code im trying to figure out how to do it if i need to explain more i can

sprite data does use variables im trying to not have undreds of varis

It sounds like what you really want is a way to determine how many detection ranges the player is inside of. If all the detection ranges are the same size/shape, this is really easy, as you can just check every guard to see if the player is close enough to be in the detection range. The problem happens if your detection ranges are different sizes or shapes. Is this the case?

Maybe sharing the project you have so far will make it easier to understand what you are trying to do.

It uses 1 variable, that each sprite has individually.