# Don't Rush, Be Quiet [Solved]

I completed Don’t Rush, Be Quiet, but when my hero moves diagonally, he is super super slow. How do I increase his speed?

Howdy and welcome to the forum!

Please post your code and include a screenshot of your equipment, so we can see what’s going on.

Here is my code.

def mod30(n):
if n >= 30:
return n - 30
else:
return n

# This function should return a value from 0 to 40 (0 <= n < 40)

def mod40(n):
# Use an if-statement to return the correct value.
if (n >= 40):
n = n - 40
return n

# You don’t need to change the following code:

while True:
time = hero.time
x = mod30(time) + 25
y = mod40(time) + 10
hero.moveXY(x, y)

Sorry, I should have been clearer. Your code needs to be properly formatted, as indentations are critical in determining proper syntax. You can learn how to format your code here: [Essentials] How To Post/Format Your Code Correctly

Also, the hero is supposed to be very slow, hence the level’s title “Don’t Rush, Be Quiet”. But, you are missing both a return statement and an else clause in the second function. You can use the first function as a template…take a close look at your second function and fix it so it is similar to the first.

Oh! Never mind then! I see that now.

I’m getting an error for the last line of code, one of the ones it says not to mess with because they’re all ready done, so it just stops at the very end, so I get hit with cannon balls.

Hello and welcome to codecombat discourse! This is a cozy forum where you can share ideas, share fan art, get assistance for code, etc! Before you proceed, we hope that you review this topic, which shows all essentials of this board! Thanks!

And also in a different topic, better, as this one is solved.

``````
# This function returns a value from 0 to 30 (0 <= n < 30)
def mod30(n):
if n >= 30:
return n - 30
else:
return n

# This function should return a value from 0 to 40 (0 <= n < 40)
def mod40(n):
# Use an if-statement to return the correct value.
if 0 <= n < 40:
return n

# You don't need to change the following code:

while True:
time = hero.time
x = mod30(time) + 25
y = mod40(time) + 10
hero.moveXY(x, y)
``````

replaced the small chunk of my code with my full code.

#side-note
Removed [SOLVED],as the discussion continues.

change that to

``````# This function should return a value from 0 to 40 (0 <= n < 40)
def mod40(n):
# Use an if-statement to return the correct value.
if n >= 40:
return n - 40
return n
``````

got it!!! thank you!!!

1 Like

Can someone help? I can’t figure out what’s happening. My guy just moves down.

``````# This function returns a value from 0 to 30 (0 <= n < 30)
def mod30(n):
if n >= 30:
return n - 30
else:
return n

# This function should return a value from 0 to 40 (0 <= n < 40)
def mod40(n):
# Use an if-statement to return the correct value.
if n <= 40:
return n - 40

return n

# You don't need to change the following code:
while True:
time = hero.time
x = mod30(time) + 25
y = mod40(time) + 10
hero.moveXY(x, y)

``````