Is there anyway let imageSprite update its position in one loop?

I want to create a 2D platformer game that you need to input all your instructions before the character(imageSprite) executes your instructions

I use a list to collect all instructions and use an "each-item in list" loop to move my character step by step at each iteration with 0.3 second delay

The problem is that my character doesn't move step by step, it moves to its final destination after the loop complete.
(For example, if I input 3 secutive "right" instruction, my character on screen should wait 0.3 sec => move right 20 pixels => wait 0.3 sec => move right 20 pixels => wait 0.3 sec => move right 20 pixels. But it turns out to be wait 0.9 sec => move right 60 pixels)

I have debugged this issue for a long time, and I'm sure my delay func works well
I only conclude that if I put several set(x,y) function in consecutive, the imageSprite only update at its final destination.

Hope someone can give an advice for tackling this problem
(ps. I'm not an English speaker, sorry for any typo or misunderstanding in my question above)

To use a delay is a bad idea in App Inventor...
After doing a search in the community you will find a lot of discussions about that

Use a clock component, set the timer interval to 300 and do a move in the Timer event


1 Like

Thanks for replying. I will try this method later.

In addition to the Clock Timer, you will need to create a list of moves that can be consumed by the Clock Timer.

Each move would combine the nature of the move and the delay required of the Clock Timer before the next move (if they vary).

Sample apps:

(fixed timing)

1 Like

Thank you for your reply too. I have learned some concept of usage of clock
But my original problem is not solved yer
I combine my move with sound like below to debug

I input 3 consecutive "left", there are 3 times of sound seperated by 0.3 sec (correct)
but the imageSprite still only update its position after 0.9 sec (wrong)

See the essays here for why this is happening:

1 Like

I did it !!! you and Taifun are truly live savers.
I am gonna to complete the rest of my mini project, thanks a lot

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.