Function: hero cast spell works once and then does not cast spell again. The hero does ‘see’ the enemy but fails to cast.
I understand that I’m not using using python and that my ‘script’ is being interpreted.
Which makes me wonder if it’s me or the interpreter that is failing.
AFWIW, Cybersec is built on confusing the enemy. Unfortunately, this enemy is paying. Going forward…
- Provide links to the source code in the level to make it easier to sort IF there is a bug?
- Allow users to leave tips to devs/other users? Flag the level as possibly buggy?
here’s the code:
# In this level you will use functions with two parameters.
# Look at the structure below, notice how there are two arguments.
# These are both accessible within the function.
def checkAndAttack(x, y): # First move to the coordinates provided by the parameters. hero.moveXY(x, y) # Then check for an enemy. # If there is one, attack it! enemy = hero.findNearestEnemy() if enemy: hero.say("Enemy mine!") #I added this to ck if hero saw the enemy at all #hero.cast("chain-lightning", enemy) # no diff same no cast on second enemy hero.cast("chain-lightning", hero.findNearestEnemy()) pass checkAndAttack(24, 42) checkAndAttack(27, 60) # Navigate to the last 3 x-marks and defeat any remaining munchkins. checkAndAttack(42, 50) checkAndAttack(39, 24) checkAndAttack(55, 29)