2017년 8월 1일 화요일

Make a sprite follow a pre-determined path


I have scoured the forum and googled this but cannot seem to find an answer.

What I would like to do is to tell a sprite to follow a pre-determined path.   I though something like this might work:

Clock:
    at 1 second move sprite to X=10, Y=20
    at 2 seconds move sprite to X=15, Y=25

but the clock function doesn't seem to work that way.  

Any ideas?

(I have no screenshots to offer because I have not made this work...sorry)

--
one possibility is put all your x and y coordinates into a list of lists
then use a global variable (let's call it index), which gets incremented in the Clock.Timer event
and select the current item from the list (using the index variable) to get a sublist of the current x and y coordinates
now use the Move method to move the sprite to that coordinates

see also

--
I will give it a go. Thank you.

--

댓글 없음:

댓글 쓰기