def moveDownRight(step):
hero.moveXY(hero.pos.x +- step, hero.pos.y - step)
# The function has the hero move to up and right.
def moveUpRight(step):
# Complete this function:
hero.moveXY(hero.pos.x - step, hero.pos.y + step)
pass
# The hunter is kind and will show the route.
hunter = hero.findFriends()[0]
route = hunter.route
routeIndex = 0
while routeIndex < len(route):
direction = route[routeIndex]
if direction > 0:
moveUpRight(8)
else:
# Use a function moveDownRight with the shift 8:
moveDownRight(8)
pass
routeIndex += 1
I have been stuck on this level for days i need help so badly i am using Alejandro the Duelist and the level is hunter valley and i cannot get to the east side!
here is what i am wearing
I completed it first try. You model the moveUpRight like the moveDownRight, only you add step after hero.pos.y. Then, when it asks for the shift of 8, on moveDownRight, you do:
First thing I see…in your moveDownRight, are you adding or subtracting step?
In both of the move functions: the hero starts at 9, 35. To move right, you add to the first element (x); to move down, you subtract from the second element (y) and to move up, you add to it instead.
Because you are using routeIndex as a counter, you need to increment it…right now, it is always going to = 0.
# Escape to the right side of the valley.
# The function has the hero move to down and right.
def moveDownRight(step):
hero.moveXY(hero.pos.x + step, hero.pos.y - step)
# The function has the hero move to up and right.
def moveUpRight(step):
# Complete this function:
hero.moveXY(hero.pos.x + step, hero.pos.y - step)
pass
# The hunter is kind and will show the route.
hunter = hero.findFriends()[0]
route = hunter.route
routeIndex = 0
while routeIndex < len(route):
direction = route[routeIndex]
if direction != 0:
moveUpRight(8)
else:
# Use a function moveDownRight with the shift 8:
moveDownRight(8)
pass
routeIndex += 1
# Escape to the right side of the valley.
# The function has the hero move to down and right.
def moveDownRight(step):
hero.moveXY(hero.pos.x + step, hero.pos.y - step)
# The function has the hero move to up and right.
def moveUpRight(step):
# Complete this function:
hero.moveXY(hero.pos.x + step, hero.pos.y + step)
pass
# The hunter is kind and will show the route.
hunter = hero.findFriends()[0]
route = hunter.route
routeIndex = 0
while routeIndex < len(route):
direction = route[routeIndex]
if direction != 0:
moveUpRight(8)
else:
moveDownRight(8)
pass
routeIndex += 1