hero.jumpTo(😄) (Python)

Im not sure I understand how this method works. If I dont stop my hero right after he jumps. He ends up sliding right into the mines but I can prevent him from sliding by making him say something right after he jumps. Does the jumpTo method have some kind of power slide once he lands?

Also does the jumpTo method have a limit on how far one can jump? I dont see how my hero can make the first 2 jumps but lands on a mine during the 3rd jump.

1 Like

Jump distance is maxed at 18. I’ve noticed the sliding too - not sure if it’s intended or not. Apparently, jumpTo must be in a loop. What I did is put jumpTo in a loop and put about a 7 second delay in there (I think it’s hero.wait(7)).

1 Like

Here’s a link to some info about jumpTo. The mods know there are problems with the function.

1 Like

Thanks. Im starting to think the new levels need to introduce some of these functions and methods. With so many questions about them it makes its frustrating to not know whats going on.

1 Like

They’re working (or will work on) the transition from the desert to cloudrip mountain. I’m guessing it’s because some of these functions aren’t explained as thoroughly as they should be.

p.s. Fun fact: The difference between a function and a method is that a function is used outside of a ‘class’, whereas methods are used inside of a ‘class’. Classes are what objects are made from (i.e. a cat is a class, Bob the Siamese cat is an object made from that class).

Can’t remember how much of this they teach in CodeCombat, but just thought I’d mention that.

Edit: One more thing: I actually wound up using a hero.say(“something”) and a hero.wait(7) in between every jump, just to make it work right.

1 Like

I found a new solution to beating this map but once again its the 3rd jump that gets me.

How is it possible to make the first 2 jumps but land on the mine during the 3rd jump?

Edit: I found something very interesting. The hero doesnt actually jump to where you want him to. In the direction your jumping he jumps one coordinate before it. For my first jump I had him jump to (22, 10) but he landed on (21, 10). The 2nd jump he was going to (22, 22) but landed on (22, 21). Now if I didnt have my hero say anything right when he landed he would of ended up sliding right into the mines.

I still dont see how this kills me on the 3rd jump but then again I dont know how the jumpTo method was written. If I want to pass im going to have to maybe move closer or move to the side of the mine.

1 Like

I just want to share with everyone that may struggle with this map. If you have had a similar problem on this map like mine. I fixed it by moving to the spot that I wanted to jump to right after the jumpTo method because jumpTo does not land where you want it to. I used moveXY to make sure I was abosulty on the spot I wanted to be and I made it to the end. I also included a wait time after the jump other wise I would slide right into the mines.


Looking at my code, I actually did that too. Amazing how many little tricks it takes to get through such a seemingly simple level. Nice catch.

1 Like