I need help with village guard!

I’ve been stuck on this level for a week!

every time i kill the first two goblins, the third one comes from the left and kills one of my villagers!
my hero can never get there quick enough, and I’ve tried everything…

I’ve reset the level so many times that i can’t post my code here cause i would have to go through all of that headache again!!

i was using lua, someone please help!!!

Hello bingoned I would like to see your code for any problems and if it can work.

You could just copy and paste your code here.

Are you moving back and forth between the two entrances? If you aren’t, then that might explain your problem.

(using Lua) If I run the default code then I get basically what you are describing, iow, I run back and forth a couple of times killing ogres, then one gets in far enough to kill a peasant before I can kill it.

But if I make the change to the code that the comments tell me to make it works perfectly.

    -- Now move to the right entrance.
    -- Use "if" to attack if there is an enemy.

The intention of the code is:
—You go left and check
—You go right and check
—repeat, until done.

All you have to do is either retype (or cough-copy&paste-cough) all the code for leftEnemy below the comments, change the move to the coords for the rightX and change those four "left"s to "right"s and BAM!! it works as intended…

heres my code, i don’t know what I’m doing wrong though!

I don’t know lua, but make the code check for an enemy. Then attack the enemy if it is there. Lastly you should make your character move to the spot where you started. Repeat.