Help with code in Stillness in motion

I need help to because there is so much problums

A man must know what is wrong before he can make it right. :wink: What is your current code? What problems are you experiencing?

As @GundericusTheMighty mentioned, you and we need to know what is wrong before we can make it right. If you are asking for the code solution, I’m not going to give you it. Codecombat and it’s levels were created so that you are able to learn how to program. When someone just gives you the solution, you don’t get the chance to just learn how to do it and use your brain to figure it out.

Please post your code (with formatting according to the FAQ), what happens, and anything else that might be helpful.

Cheers! - @Luke10

Stuck in this Level, I keep getting a error saying distance is not defined not sure what I am doing wrong I have my distance defined as well as my enemy
local enemy = self:findNearestEnemy()
if enemy then
distance = self:distanceTo(enemy)
after this if the distance is < 5 then I am supposed to attack if enemy = true otherwise shield but I can seem to get there.

1 Like

You forgot to declare the variable using local it seems.

local distance = self:distanceTo(enemy)
3 Likes

Thank you, I thought I tried that already.