Good day!
So I was creating a sequence where a guard would be patrolling an area, and you could sneak up on him from behind and shoot him(or just sneak by) to disable the threat. I got the patrolling part to work, but how would I go about creating the shooting part?
Currently I have a very rough system of when the player is on the same alignment of X or Y as the patrolling guard, they could pull the trigger and it would hit(Previously they could even hit through walls).
The problem is that they can hit the guard from infinite range, and having players just shooting a volley of bullets and hitting the guards outside the screen just seems ridiculous.
So I thought to put a distance check for the player and the event, and only allow the player to hit when the guard is in range (say, 4 or 5 tiles.), but so far I haven't been able to find any way to actually achieve that. Any ideas?
So I was creating a sequence where a guard would be patrolling an area, and you could sneak up on him from behind and shoot him(or just sneak by) to disable the threat. I got the patrolling part to work, but how would I go about creating the shooting part?
Currently I have a very rough system of when the player is on the same alignment of X or Y as the patrolling guard, they could pull the trigger and it would hit(Previously they could even hit through walls).
The problem is that they can hit the guard from infinite range, and having players just shooting a volley of bullets and hitting the guards outside the screen just seems ridiculous.
So I thought to put a distance check for the player and the event, and only allow the player to hit when the guard is in range (say, 4 or 5 tiles.), but so far I haven't been able to find any way to actually achieve that. Any ideas?