Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[SOLVED] Need help with Almost Perfect Minefield: hero doesnt jump!

pls, I can’t beat Almost Perfect Minefield. Help!

pls tell me any errors, here is my code:

# https://codecombat.com/play/level/almost-perfect-minefield
# Escape from the minefield.
# You need to pass the marked line. (x = 72).

trapDistance = 6
trapRange = 3
jump = ['up', 'up', 'up', 'up', 'right', 'right', 'right', 'down', 'down','left', 'down', 'down', 'right', 'right', 'right', 'right']
index =  0
# Jump, Jump, JUMP!!!
while index<len(jump):
    if(hero.isReady('jump')):
        if jump[index]=='right':
            where = {'x': (hero.pos.x +(trapDistance)*2), 'y':hero.pos.y}
        elif jump[index]=='left':
            where = {'x': (hero.pos.x -(trapDistance)*2), 'y':hero.pos.y}
        elif jump[index]=='up':
            where = {'x': hero.pos.x, 'y':(hero.pos.y +(trapDistance)*2)}
        else:
            where = {'x': hero.pos.x, 'y':(hero.pos.y - (trapDistance)*2)}
        hero.jumpTo(where)
        index = index +  1
    else:
        hero.move(where)

Maybe you can try defining where variable at the top along with the other variables as where = None

ok I’ll try that(20 charrrrrrrrrrrrrrrrrrrrrssssssssssssss)

nope did not work :frowning: (dumb 20 chars)

the problem is my hero keeps on just moving, not jumping, into the trap.

Try if jump is ready jump

ok, I think my hero be sliding into trap

how should I fix that

wait i found a creative way to use da baby grif pet

1 Like

carry them to other side hahaha

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.