I am a total beginner to game dev, but when I checked a little bit on this stuff, it's probably not so easy as you say it is to do something like this, especially for web but even just anyway. I guess though it might depend what the enemies are, how many of them there are and some other things.