Hey guy’s I having trouble with my code in Shrapnel and it passes but I do not make any explosions here is my code
while True:
enemy = hero.findNearestEnemy()
if enemy:
distance = hero.distanceTo(enemy)
if distance == hero.throwRange:
hero.throwRange - 15
else:
hero.attack(enemy)
If somone could figure out why please show me and thanks
if distance == hero.throwRange:
hero.throwRange - 15
to
if distance <= hero.throwRange:
hero.throw(enemy)
because in the first line you are checking only if the distance exactly equals your throw range, but it can also be less than your throw range and it will work, then in the second line you are trying to decrease your throw range by 15, which i don’t under stand why you did this, you don’t need to decrease your throw range, even if you try it won’t be decreased, but you need to throw the enemy, so you need to use hero.throw(enemy)