> You can check the distance to the players.
> distance(bomb.X,bomb.Y,hero.X,hero.Y)
This doesnt work becasue if the player is running around surely one of the bombs will not be in range and it will just fall through the floor and if the player keeps on runnning a certain direction then the bombs will then just start falling
I created an example of how I would use this in a game.
We can't just throw grenades we need to add conditions that make the attack more real.
--Each enemy should have a radius of attack and if the player does not approach him he does not see him and does not throw a grenade (you can see on the screen).
--Each grenade should have a delay before the explosion, after the time has passed it explodes as in the real world.
--Grenades can't be thrown with absolute precision they must have a spread of accuracy, enemies can't be absolutely accurate like Robin Hood.
File c3p