Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Backwoods Standoff - running out of time

I could use some help with this. From what I can tell, my code is correct, but I keep running out of time.

First, welcome to the forum!

For your issue, I think the problem is in these lines of code:

if enemy:

You should be checking for if the hero can cleave (lines 8-9). You should also attack the enemy only when it exists. Your code should look something like this

if an enemy exists:
    if the hero can cleave the enemy:
        then cleave the enemy
        then attack the enemy

hope this helps!


Thank you for that advice, Anna. My hero can cleave. She kills the munchkins - three rounds of them. The result I get from the game is a message that I “ran out of time.”

Wait so it still doesn’t work?

Yes. The code runs. My hero cleaves. Three onslaughts of munchkins die. And I run out of time. I can’t figure out what is wrong.

Can you post your changed code?

It’s up at the top of this thread.

I just looked over my code. I added a pass to the end after the else statement. Aside from what the advice I gave you at the top, I can’t find any other issues. @Deadpool198, @AnSeDra, @dedreous, @Chaboi_3000, any ideas?

1 Like

Can I see your recent code?


Please could you also show us a screenshot of this issue.


Yes, your hero can cleave, since they have the correct sword. However, once he cleave’s there is a ‘cooldown’ period, which means you must wait for this move to be available again. As written, your hero constantly tries to cleave. Instead, try this:

if enemy and ready to cleave, then:
elif enemy:
    kill it

That’s funny. I did it with the else instead of the elif and it didn’t say ‘ran out of time’.

heh…well, if you completed the level, that’s what counts!

I only used the ‘elif’ to test for enemy again…not always required, but is a good habit to get in to.

Mod edit: thank you for posting, but solutions are not allowed.
This was my code and it worked for me. Hope this helps.

Hi @Lydia_Song, Thanks for trying to help, but sharing solutions is against the rules of this forum. Instead we try to help people understand code and coding so they can use it in the future.
“Give a man a fish and he’ll eat for a day; teach a man to fish, and he’ll eat for a lifetime” (or woman, either one).
I’ve removed the code.


Here is a screenshot of my code. I’ve also tried following advice from @dedreous in line 10, but the results are the same. My hero survives, but I get a message that I’ve run out of time.

Here’s what my game looks like.

Kowens…delete line 8, it does absolutely nothing. Edit line 7 to equate this statement:

if there is an enemy AND the hero is ready to cleave, then:

Ok, I won’t post solutions again.


Thank you @dedreous. I’m very new at this and I can’t figure out how to add the additional command in the code. I keep getting error messages, because I’m doing wrong. Can you give me some guidance?