Hi there!
I'm using basically a loop in a function that moves the player by incrementing it's position, until it has reached the target. This works fine, however it requires a 'sync()' to actually show the movement in progress or it'll just skip to the end and only update once then.
Same deal in case I would have used a while loop, like so:
targetreach = 0
while targetreach = 0
if not GetObjectX(objplayer) = target_posx# // not at target?
SetObjectPosition(objplayer,GetObjectX(objplayer)-(xxx#/16),Getobjecty(objplayer),GetObjectz(objplayer))
endif
if not GetObjecty(objplayer) = target_posy# // not at target?
SetObjectPosition(objplayer,GetObjectX(objplayer),Getobjecty(objplayer)-(yyy#/16),GetObjectz(objplayer))
endif
if not GetObjectz(objplayer) = target_posz# // not at target?
SetObjectPosition(objplayer,GetObjectX(objplayer),Getobjecty(objplayer),GetObjectz(objplayer)-(zzz#/16))
endif
if GetObjectx(objplayer) = target_posx# and GetObjecty(objplayer) = target_posy# and GetObjectz(objplayer) = target_posz#
targetreach = 1
endif
sync()
endwhile
xxx# , yyy# and zzz# are nothing special, just the distance to target in a positive or negative value.
My question is... how do I make an object continue to visibly move until the target, whilst NOT pausing anything else that happens in my game?? I've got a feeling I'm overlooking something really easy bigtime here, to do with general code structure, but can't seem to find the issue.