I’m moving my character around using a Tween behaviour and I am trying to restrict his movement to a “grid” of 32 pixels. It works fine when moving in a straight direction, but when two or more directions are given at once, he seems to move off this “grid”
Do you want 2 keys can be pressed at once? If not,
avoid two keys to be pressed at same time.
In your first event add:
a key is pressed (invert condition)
w key is pressed (invert condition)
s key is pressed (invert condition)
I wasn’t saying tween, I was saying actually modify the position of the sprite to snap to the closest x / 32 and y / 32.
If I was you I’d redesign the movement logic entirely to use a single tween that moves from the current location to the target location. The input keys would only modify the target location if the tween was not currently playing. But first check if the tween is not playing and the target location is not equal to the current location, in which case play the tween to move from the current location to the target location.