I’m currently on the level “zoo keeper” and I’m having a tough time getting my head around using objects other than direct x and y values in the move() action. I’ve used it successfully in examples like:
loop:
self.move({"x": 25, "y": 25})
But I haven’t found an example / a way to understand how to move the the position given by an object (as an example here, to the x and y position given by the “points” variable that I’m looping through).
Can someone post an example of using the move() with other object values than simple coordinates? That would be really helpful
Technically both examples should work, but because point is already an object with an x and a y property values it’s easier to use point. Why the first example doesn’t work I have no clue.
moveXY behaves differently, as explained in the first set of mountain levels. I doubt you can call moveXY on a minion, and you probably wouldn’t want to (at least in future situations), because moveXY moves all the way.
Also, there is a custom Vector class built in; while there are a lot of new methods, the most basic usage is to use it like Vector(x, y):
The “first one” doesn’t work because it is “points” not “point”, “points” is probably an array of position (pos) objects ("point"s) and not a pos object.