[Solved] Total Brain Freeze--Need Help!


#1

Ok, I admit it. I am a noob and I really should probably know this. Here is my problem:

I need to move to the coordinates provided by the parameters. Now, The only move codes I have really used so far are the hero.moveXY(x, y) and the really noob one hero.moveUp. So anyways, therein lies my problem. Any help would be appreciate! I will continue to ponder this while waiting for help. If I haven’t post a “solved” reply, it’s still beating inside my head along with the spider that rents the place out!

def checkAndAttack(x, y):
# First move to the coordinates provided by the parameters.

# Then check for an enemy.
enemy = hero.findNearestEnemy()
# If there is one, attack it!
if enemy:
    hero.attack(enemy)
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)


#2

It would be nice to see link to the level you stuck on. And I don’t understand do you really define the function?


#3

Do that.

Also please post with beautiful formatting using the 3 ` before and after your code.


#4

Thanks for the comments, I appreciate any help I can get. (SuperSmacker, I appreciate the tip on “coding conduct”. I think the problem was in the interpretation of the directions. I figured out the problem and created a string to handle the movements.


#5

Topic marked as solved.