Self.move and hero.move


#1

are here any differences between self.move and hero.move?I am still using hero.move,but i’ve noticed that most of the players use self.move


#2

self is an old one. But it’s still used for the backward compatibility.


#3

Ok, let me ask something along these lines as well. I just purchased the “Reinfocred boots” (huge mistake and I hate the skill gain). I no longer have the hero.moveRight, Up, Down, or Left options. It now ask me to use hero.moveXY(x, y) and I can not figure out the correct numbers to use. Any help would be useful. By the way, I am on “the Last kithmaze”


#4

@Michael_Howard you can always change back to the original boots.

The hero has a position. So if you want to move to the right you could keep the same Hero.pos.y and increment the Hero.pos.x + 12 to move.


#5

I have tried changing back to regular boots… did not remove the XY moving. I found a map that tell the coordinates tho. Will be a whole lot longer then 10 lines it wants on the goal, but I can live with it as long as I pass this lvl.

Thank you for help.


#6

Well, this sucks. It will not let you pass this level if you have more then 10 statements but there is no way to fit all this code into less then 28 lines while using hero.moveXY. Here is what I have:

hero.moveXY(18, 22)
hero.moveXY(18, 34)
enemy1 = hero.findNearestEnemy()
hero.attack(enemy1)
hero.attack(enemy1)
hero.moveXY(30, 34)
hero.moveXY(30, 11)
hero.moveXY(30, 22)
hero.moveXY(42, 22)
hero.moveXY(42, 34)
enemy2 = hero.findNearestEnemy()
hero.attack(enemy2)
hero.attack(enemy2)
hero.moveXY(54, 34)
hero.moveXY(54, 11)
hero.moveXY(54, 22)
hero.moveXY(66, 22)
hero.moveXY(66, 34)
enemy3 = hero.findNearestEnemy()
hero.attack(enemy3)
hero.attack(enemy3)
hero.moveXY(79, 34)
hero.moveXY(78, 11)
hero.moveXY(78, 22)
hero.moveXY(92, 22)

P.S. : I finally figured it out. I had to remove boots, then change to another character before it would remove the moveXY ability. Thank you for the help.


#7

So thre are actually no differences between them?self is old one and hero is new one


#8

You might want to revisit “Fire Dancing” or the “Haunted Kithmaze”.

If you look at the syntax that is being taught, they want you to make use of the prior syntax for a while loop that you learned earlier.


#9

@Guldauren_Bisenbaeva in many cases self. and hero. will refer to the same thing by the way the game is coded.

Try using self. for other things like self.say(“Hello”)

It shouldn’t matter which you use from here on out. But if hero.move is the new way I would recommend using “hero”. I have completed all of the game levels using “hero” without any issues.

-HW


#10

it would not let me use moveRight, moveUp, moveLeft, moveDown while I was wearing the boots Harry_the_Wanderer and thus I was attempting to figure it out using the hero.moveXY(x, y) movements, -which were the only movements it would allow me to use with the boots on. I finally managed to remove the boots by removing the boots and then switching toons which granted me the hero.moveRight and such. I have now beat and passed this level.


#11

@Michael_Howard I understand.

The while loop will still work with hero.moveXY() but you have to approach the problem from a different point.

hero.pos.x
hero.pos.y

Will help.


#12

I am so totally new to coding that I find it rather difficult to understand much about it. When I was 8 years old, I taught myself to code (somewhat) in BASIC, which is now a dead language. That was back in the mid 80’s and I have forgotten all I knew back then so I am basically starting from scratch as a total noob at 40 years old but, it will be even more difficult for me because fo a brain injury I sustained in 95 which means I will have to work 10x as hard to learn & remember what I learn. I am doing the absolute best I can right now, but, hero.pos.x and hero.pos.y does not really compute in my mind at this time. When explaining something like this to me, you will have to be detailed and specific as to what it does as well as how to right it properly. Then I can use it “IN-GAME” and learn from it. I really truly thank you all for helping me on this board.


#13

@Michael_Howard no worries. Are you using Python to program?

Try this syntax:

hero.moveXY(hero.pos.x + 12, hero.pos.y)

It should give about the same effect as

hero.moveRight()


hero is an object.
pos is an object. (position)

pos.x is the exact x location, for instance 12
pos.y is the exact y location, for instance 8

the hero has a pos (position).

So by using hero.pos.x we get the hero’s exact X location. Does that make sense?

You can always try this command and see what prints out:

hero.say(hero.pos.x)


#14

ok, thanx Harry. I am sorting through monthly bills to arrange things where I can pay the $10 a month to subscribe to the game to continue to learn more. I just finished all the boards on that level and it put me in some forest looking map and will not let me pass till I start paying hehe. So, soon as I get things figured out, as Arnold would say, " I’LL BE BACK! "

thanx tons for the understanding and help Harry.


#15

@Michael_Howard I am always glad to help. I am busy, but sharing the gift of coding is something that motivates me.