Yeah, that's possible.
In the character settings, set death to detonate. And then in the looping command prompt, put this:
if distance to character 1 < 50
kill enemy
Change "1" to the character ID for your main character.
Change "50" to your desired distance.
I just noticed that "if distance to" is not in the list of conditionals on the website. I'll fix that...