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)
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)