Freeform Movement - Possible?

Hey there,

Is it possible to do freeform movement with the latest version of MTE? I’ve been testing out touch movement, and while it works with sprites going from tile to tile, it feels rather…sloppy. Ideally I’d like to be able to touch any spot on the screen, and have the sprite move to that exact spot, even within a tile.

I guess my question is really, is it possible to do a moveSpriteTo with a set of touch event coordinates rather than just the tile (so you can move freely around the map, not constrained to any individual tile)?

Thanks!

Yes, of course! You can pass levelPosX and levelPosY parameters to moveSpriteTo() and moveCameraTo() in the same way as locX and locY. In your case you’ll want to use screenToLevelPos() to convert your touch event coordinates to level coordinates before passing them to the movement functions. I suggest checking out the API document to see all the different options for these functions.

Awesome, thanks Dyson!

Yes, of course! You can pass levelPosX and levelPosY parameters to moveSpriteTo() and moveCameraTo() in the same way as locX and locY. In your case you’ll want to use screenToLevelPos() to convert your touch event coordinates to level coordinates before passing them to the movement functions. I suggest checking out the API document to see all the different options for these functions.

Awesome, thanks Dyson!