Make sure you do not attack Charles. Delete the code for “enemy3”.
Also, do not use hero.attack. The mortar will fire for you. Instead of hero.attack(enemy4), find the distance to enemy4 using distanceTo and then say distance4
Also please format your code according to the FAQ. It helps us better understand you code and also helps us figure out what is wrong. Go to: https://discourse.codecombat.com/faq.
To format correctly, you would put triple (`)'s, around your code so that:
enemy = self.findNearestEnemy
if enemy:
self.attack(enemy)
becomes this:
enemy = self.findNearestEnemy
if enemy:
self.attack(enemy)
Please don’t post solutions. The purpose of this board is to help people learn so that they can figure out levels on their own. Simply providing solutions does not help and is counterproductive to this goal. The two main rules here on this board are no swearing and no posting solutions. Thanks and welcome to the board.
Guy’s i finally solved it here ill give u the code that i used.
Mod edit: Please don’t post solutions. The purpose of this board is to help people learn so that they can figure out levels on their own. Simply providing solutions does not help and is counterproductive to this goal. The two main rules here on this board are no swearing (be nice) and no posting solutions. Thanks and welcome to the board.
Hi @Forknife3. Welcome to the CodeCombat Discourse.
I’m very happy to help you with your code, but this forum isn’t for giving solutions. Because you learn a lot more from trying, with help if you’re stuck, than using someone else’s solution.
Thanks,
-Danny
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!
@Jose_Lopez1 could you please make your own topic with your code. Please do not revive dead topics
thank you
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!
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!