Hi…
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.
For instance:
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.
I think is easier keeping like it is and check if other keys are not pressed. The way you suggest he needs to check if 3 different tweens are not playing.
I used a premade function which also works like a charm, but ty for all suggestions. Your suggestions obviously provide more flexibility than a premade function. Ty.