i feel like it should work but tell me what you think
Protect your base.
Spawn units to assault the enemy base.
Cast spells to react on enemies.
while True:
hero.summon(“thrower”, “A”)
hero.summon(“thrower”, “A”)
hero.summon(“thrower”, “A”)
hero.summon(“thrower”, “A”)
hero.summon(“thrower”, “A”)
hero.summon(“thrower”, “A”)
hero.summon(“thrower”, “A”)
hero.summon(“brawler”, “A”)
if hero.time > 153:
hero.cast(“fireball”, 16, 33)
hero.summon(“thrower”, 77, 40)
hero.summon(“brawler”, “A”)
hero.summon(“brawler”, “A”)
hero.summon(“thrower”, 77, 40)
hero.summon(“thrower”, 77, 40)
hero.summon(“thrower”, 77, 40)
hero.summon(“thrower”, 77, 40)
hero.cast(“fireball”, 77, 40)
hero.summon(“brawler”, 77, 40)
badGuy = hero.findEnemies()
badGuy = hero.findEnemies(“badGuy”)
var (tx = (“badGuy”),unit.x)
var (ty = (“thrower”),unit.y)
enemy = hero.findNearestEnemy()
if badGuy:
badGuy.x = 20
badGuy.y = 30
hero.cast(“fireball”, tx, ty)
Hello and welcome to the Code Combat discourse. We have some amazing people who would LOVE to help you with bugs, creating levels, and getting through levels. Don’t forget though, when you need help, create a new level, and format your code correctly Or, you can just chat with others in topics. Please go to this topic: here to see more details. We would be happy to just chat with you to!
1 Like
I haven’t done Code Combat for a bit but can I please get a link to the level? Or you can tell me which world it is in.
It is the new arena
for the link um any other assistance
Aya
September 23, 2021, 4:08pm
5
Hi @Evan_Barclay and welcome to the discourse This is a friendly place where you can ask for help on levels, report bugs, and chat with other coders. Hope you enjoy your time here.
Link:
1 Like
Aya
September 23, 2021, 4:21pm
6
And please, don’t forget to format your code correctly using this button, otherwise, we might not be able to help
1 Like
Coder3
September 23, 2021, 4:28pm
7
while True:
hero.summon(“thrower”, “A”)
hero.summon(“thrower”, “A”)
hero.summon(“thrower”, “A”)
hero.summon(“thrower”, “A”)
hero.summon(“thrower”, “A”)
hero.summon(“thrower”, “A”)
hero.summon(“thrower”, “A”)
hero.summon(“brawler”, “A”)
if hero.time > 120:
hero.cast(“fireball”, 16, 33)
hero.summon(“thrower”, 70, 40)
hero.summon(“brawler”, “A”)
hero.summon(“brawler”, “A”)
hero.summon(“thrower”, 70, 40)
hero.summon(“thrower”, 70, 40)
hero.summon(“thrower”, 70, 40)
hero.summon(“thrower”, 77, 40)
hero.cast(“fireball”, 70, 40)
hero.summon(“brawler”, 70, 40)
badGuys1 = hero.findEnemies()
badGuys = hero.findEnemies(“badGuy”)
badGuy=hero.findNearest(badGuys)
tx = badGuy.x
ty=badGuy.y
hero.cast(“fireball”, tx, ty)
next time format you code like this:
while True:
hero.summon(“thrower”, “A”)
hero.summon(“thrower”, “A”)
hero.summon(“thrower”, “A”)
hero.summon(“thrower”, “A”)
hero.summon(“thrower”, “A”)
hero.summon(“thrower”, “A”)
hero.summon(“thrower”, “A”)
hero.summon(“brawler”, “A”)
if hero.time > 120:
hero.cast(“fireball”, 16, 33)
hero.summon(“thrower”, 70, 40)
hero.summon(“brawler”, “A”)
hero.summon(“brawler”, “A”)
hero.summon(“thrower”, 70, 40)
hero.summon(“thrower”, 70, 40)
hero.summon(“thrower”, 70, 40)
hero.summon(“thrower”, 77, 40)
hero.cast(“fireball”, 70, 40)
hero.summon(“brawler”, 70, 40)
badGuys1 = hero.findEnemies()
badGuys = hero.findEnemies(“badGuy”)
badGuy=hero.findNearest(badGuys)
tx = badGuy.x
the problem for me is your using you " like this ” instead of this "
Coder3
September 23, 2021, 10:02pm
11
I think I fixed the code?
1 Like
hey thank you for trying to help me I didn’t include the full text sorry here it is , also could somebody tell me how i would find the coordinates of the closest enemy so i could fire a fireball at them
hero.summon("thrower", "A")
hero.summon("thrower", "A")
hero.summon("thrower", "A")
hero.summon("thrower", "A")
hero.summon("thrower", "A")
hero.summon("thrower", "A")
hero.summon("thrower", "A")
hero.summon("brawler", "A")
if hero.time > 153:
hero.cast("fireball", 16, 33)
hero.summon("thrower", 77, 40)
hero.summon("brawler", "A")
hero.summon("brawler", "A")
hero.summon("thrower", 77, 40)
hero.summon("thrower", 77, 40)
hero.summon("thrower", 77, 40)
hero.summon("thrower", 77, 40)
hero.cast("fireball", 77, 40)
hero.summon("brawler", 77, 40)
badGuy = hero.findEnemies()
badGuy = hero.findEnemies("badGuy")
var (tx = ("badGuy"),unit.x)
var (ty = ("thrower"),unit.y)
enemy = hero.findNearestEnemy()
if badGuy:
badGuy.x = 20
badGuy.y = 30
hero.cast("fireball", tx, ty)
also this is in the giants gate game mode where you battle against class mates
Okay, you don’t actually need the exact co-ordinates as you can just type in
enemy = hero.findNearestEnemy
hero.moveXY(enemy.pos.x, enemy.pos.y)
and that is all you need. Because the 1st line means that your hero will find the nearest enemy.
The second line is for the hero to move to the enemy’s x and y position. the computer will solve the x and y co-ordintates as the enemy you are looking for will move around most of the time and the hero is trying to navigate its way to the nearest enemy and attack it.
Antoni.D
(Ps. If this was helpful please like!)
Coder3
September 24, 2021, 12:51am
15
Yeah, thats actually all you need unless you fight with a munchkin. You’ll need to calculate speed in also. I’m under 12. Haven’t officially entered middle school yet(Though I went in to see a friend).
Hin_Lee
October 25, 2021, 2:19am
16
Also, what is with
It should be badGuy = hero.findNearest(badGuy)