Can someone help me to update this code of Colossus:
def guard(e):
colossus = e.colossus
place = e.place
while True:
enemy = colossus.findNearestEnemy() or hero.findNearestEnemy()
if enemy and enemy.health > 0:
if colossus.isReady() and colossus.distanceTo(enemy) < colossus.specialRange:
colossus.special(enemy)
else:
colossus.attack(enemy)
def choose(place):
return {
‘B’: ‘hyperion’,
‘C’: ‘hyperion’
}[place]
hero.chooseColossus = choose
hero.on(‘spawn-colossus’, guard)
while True:
hero.summon(‘munchkin’, ‘B’)
hero.summon(‘ogre’, ‘C’)
2 things… First, please format your code using the “</>” button in the forum… Also, please give the level link, your hero, and equipment.
fuery
May 18, 2023, 5:45pm
3
couple things
Format. Surround your code block with ``` to format it like so:
#code here
#some more code
#code also here
#maybe some more code here
#etc
Provide the link of the level you are stuck on.
Specify the problem you are having.
If applicable, provide screenshots of the equipment you are using, and any errors you may be encountering.
Add a tag to your post. please.
Uh, quick note: I already told the original poster to format the code, and post the hero and equipment (steps 1, 2, and 4)
Done
PS: this might be a little bit wrong
def guard(e):
colossus = e.colossus
place = e.place
while True:
enemy = colossus.findNearestEnemy() or hero.findNearestEnemy()
if enemy and enemy.health > 0:
if colossus.isReady() and colossus.distanceTo(enemy) <
colossus.specialRange:
colossus.special(enemy)
else:
colossus.attack(enemy)
def choose(place):
return {
‘B’: ‘hyperion’,
‘C’: ‘hyperion’
}[place]
hero.chooseColossus = choose
hero.on(‘spawn-colossus’, guard)
while True:
hero.summon(‘munchkin’, ‘B’)
hero.summon(‘ogre’, ‘C’)
The format looks right… So now, what is your hero and equipment? Post a screenshot of the game before loading the level.