# The player only needs to defeat some of the enemies.
game.spawnPlayerXY("guardian", 62, 25);
# Use game.addDefeatGoal(X) to allow the player to win
# after defeating X enemies! (In this case, X should be 4)
x = 4
unit = "gaurdian"
game.addDefeatGoal("guardian", "spawn", x)
enemy = unit.findNearestEnemy
while True:
unit.attack(enemy)
I dont know what im doing wrong exactly can someone try this in their codecombat and see if it works?
instead of “x = 4
unit = “gaurdian”
game.addDefeatGoal(“guardian”, “spawn”, x)
enemy = unit.findNearestEnemy”
while True:
unit.attack(enemy)", use “game.addDefeatGoal(4);”.
Hopefully this works! :>
Hello and welcome to the discourse @mykhullr.17!
Please don’t revive dead topics as most of the people in this topic aren’t active and this is already solved