When you say a 2D table, do you mean like a grid and checking the next square to see if it's open to walk to?
I've never used the tween commands before so I'd say position the sprite manually.
dx and
dy are normalized direction vector pointing the sprite towards its destination. If your sprite can only move along the axis, then:
right => dx=1,dy=0
left => dx=-1, dy=0
up => dx=0, dy=-1
down = dx=0, dy=1
If it can move diagonally, then determine the angle to the target and calculate the vector like this:
dx = cos(angle)
dy = sin(angle)
speed is how fast you want to move (obviously).
When you're ready to make the sprite move, set the flag
spriteMoving. Don't forget to switch the flag off once the sprite reaches the intended target.
do
if spriteMoving = 1
// Update sprite's position
x = x + dx*speed
y = y + dy*speed
setSpritePosition(mySprite, x, y)
// Check if sprite reached destination, stop moving
if abs(x - destX) < speed and abs(y - destY) < speed
spriteMoving = 0
endif
endif
sync()
loop