i need help with Siege of Stonehold
I think you need to at least try coding some before you ask for help. You may figure it out.
Okay, try going back to other levels to make sure your code is correct. You’re missing a couple very important lines of code.
Also, I recommend reading carefully the blue script above. They give you a few hints.
Yes, as @CocoCharlie said, you will definitely need to expand on that code to complete the level.
Remember in previous levels you have used while True loops to repeat an action over and over again? You should use one here.
You’ve defined enemy correctly (enemy = hero.findNearestEnemy()), but then you attack it without checking if it exists. What if there is no enemy? You will get an error. You can use a conditional statement. (if enemy:) That’s something which will only run the code inside it if the condition or statement in the if line is true. So if you had:
if enemy: hero.attack(enemy)
The hero would only attack the enemy if it existed. This is good.
You need to do the same thing for cleave. However, this time it’s more complicated. You have to check for two things: whether you’re ready to cleave and whether there’s an enemy. Remember you can use
and in if statements when you need two conditions to be true.
This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.