Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Help with "Stillness in Motion" level?


My code works fine, but my character doesn’t seem to have good enough armor to survive the whole time. Is there a trick to the level or am I going to have to come back to it with better gear?


That would be a hard question to answer with knowing your weapon and especially your armor (maxHealth - when in the level, point your mouse at the focus display (where it shows your hero right below the map) and point at the health bar: currentHealth/maxHealth).

Also how much time is left when you die? (knowing your weapon, health, and remaining time will help us decide if we would suggest a better weapon, armor, or ???)

Do you have a secondary weapon (warrior = bash shield) and are you attacking with it? It may not do as much damage as your primary, but in a lot of cases it hits faster (less wait until next action) and so lets you do more damage over time.


I also thought this level was slightly too hard considering where in the campaign it is. Especially the two throwers spawning around the 30 seconds mark makes the fight extra difficult. Using the strategy suggested in the comments I think you need at least around 450 health using the long sword (which I think most players would be using) and the steel striker shield.

Maybe one thrower could be removed or have them appear a bit later to make the difficulty more in line with the surrounding levels.


I’ve rebalanced this level. Let me know how it goes, if you’re still dying too quickly! Sometimes those ogres get over-eager :wink:


Tried it again and now it is doable with 200ish hp. Seems more in line with the surrounding levels while still proving the point about using distance to decide whether to attack or not. Maybe too easy? Nah j/k. Good job balancing.


i need the code please i cant find out how to beat it


We don’t give out proper code as a regular policy. It provides an easy answer without letting the user learn how the solution works.

At least tell us what your problem is. Maybe post your code (formatted properly, of course).


no matter what somthing is always saying add if statement but i already did or i cant get the >5 to work


Could you show us your code?

I believe in this level you need to check IF there is enemy, and then IF their distance is less than 5m. Nested IF statements.


This is my code for the level.
It keeps telling me that on the “distance to” line the target is undefined. I think there is an error in my code but can’t seem to find it. Any suggestions?

loop {
    var enemy = this.findNearestEnemy();
    var distance = this.distanceTo(enemy);
    if (enemy) {
        if (distance < 5) {
        else {
    else {
        this.moveXY(34, 40);


Hello, Max, and welcome. Please read the FAQ prior to your next post, so that you can learn how to format code properly. I’ve done it for you this time, but you should earn to do it on your own.

Your problem is that you check the distance to an enemy before you check if there is an enemy. Move the line where you define distance inside the if (enemy) { block.


Ok… Thank you! I appreciate the help and am also very impressed by the speed of that response.
I will make sure to format the code properly next time.
Thank you!


It says “An unexpected token.” What does that mean?


Unexpected token means you have a character (or a sequence of characters) where it does not belong, or otherwise missing a character or a sequence of characters somewhere. In other words, it means your program’s syntax is invalid.

There’s a very off chance that the syntax you’re using is not implemented yet in CodeCombat’s compiler (happens with some Python 3 and JavaScript ECMAScript 2015 features) or that you have found a compiler bug, but this is a rare case as those are not yet taught in CodeCombat nor necessary to complete the levels.

Please post your code (correctly formatted) so we can help you.


It is the main reason why I can’t beat some levels. Also, that was a fast response!


Hahah, no problem. If you need further help, please post the code you’re having problems with, otherwise we can’t really help on this issue. :wink:

“Unexpected token” is a very generic error that is thrown when the parser finds something “unexpected”—i.e. any kind of invalid syntax. It might be due to a dot, colon, comma, parenthesis, bracket, any character or word out of place or missing. Anything really. It happens for minuscule and large mistakes alike.


enemy = self.findNearestEnemy()
distance = self.distanceTo(Enemy)
if self.distanceTo(enemy) :
self.distanceTo(enemy) > 10 :


What’s wrong with it?


It doesn’t show indents…


Looks like you’re missing an if before self.distanceTo(enemy) > 10 :

Also please edit your post and add triple backticks (```) before and after your code, so the indentation is rendered correctly.