When I want to use hero.moveXY(*sometuple) it does not appear to unpack the tuple and I still have to provide both positional arguments. This kind of adds extra work, and x & y are a logical pair so ideally could use together.
This forced me to call hero.moveXY(sometuple[0], sometuple[1])
Could we add support for unpacking via *?
Error message in the game:
ArgumentError: moveXY takes only undefined argument. should have type number, but got null.
moveXY requires 2 numbers as arguments, x and y.
Hi @AlyTomji, welcome to the community !
I think I can help your, but I don’t really understand the what the “sometuple” means. Like double, triple, quadruple, or as a variable? I don’t think “double” is a square or something like that? Sorry, I don’t really understand what “sometuple” means (I’m only 6th Primary). Let me try: hero.moveXY(x, y) takes in two variables, which of both should be numbers. If you type hero.moveXY(quintuple, triple); it won’t register as quintuple and triple are both tuples, not numbers. And also, hero.moveXY(x, y); requires two variables, so if you only put one, even if we can make it a variable and dissect it into somethingX, somethingY, you actually can’t because 34 is not a valid identifier. And also if you are talking about graphs, I don’t think Javascript can dissect it. This example is xy - 5 = 0:
You said that because the asterisk can’t unpack a variable, but how do you unpack a tuple? Also, tuples aren’t graphs (according to my knowledge (which might be wrong, I dunno)), so the asterisk can’t dissect it even if it can. You can use a hero.move(targetPosition); to move the hero if you want to use a single argument, but if you don’t want the hero to move for only a short distance, use a while loop.
Hopefully, this helped! — Ethan