subject: Have Codea a Pause mode?
Can I do this…
i have an object (for example, cat)
cat position: (x,20)
the cat go ten steps to the right → x=x+10
pause, waiting, (2seconds) —> Code?
the cat go ten steps to the left → x=x-10
(without complex controlstructures, it’s for children)
If you want a simple method you can look at tween.delay().
@AnnSophie If you’re looking for something simple to move a sprite around the screen and pause, try this. The sprite is controlled by what’s in the “dirTab” table. It contains 3 values per entry. The first is the x direction, the second is the y direction, and the third is the number of seconds to pause after that move. In the example below, the sprite starts at x=100 y=100. In the “dirTab”, the first move is 200 for x, 20 for y, and a pause for 5 seconds. It will then move -100 for x, and -10 for y, and pause for 4 seconds. It will then move -5 for x, 200 for y, and pause for 6 seconds. After that it will then start at the beginning of the table and continue those moves. You can add more values to the “dirTab” as long as they’re vec3(x,y,pause). If the sprite goes off the screen, it will move to the center and continue.
background(40, 40, 50)
if x<0 or x>WIDTH or y<0 or y>HEIGHT then
sprite("Planet Cute:Character Princess Girl",x,y)
if xcount==0 and ycount==0 then
if delay>0 then
if offset>#dirTab then
if xcount~=0 then
if dirTab[offset].x>0 then
if xcount>0 then
xcount = xcount - 1
if dirTab[offset].x<0 then
if xcount<0 then
xcount = xcount + 1
if ycount~=0 then
if dirTab[offset].y>0 then
if ycount>0 then
ycount = ycount - 1
if dirTab[offset].y<0 then
if ycount<0 then
ycount = ycount + 1
This could easily be done with tween.delay.
I feel like it would be more appropriate to use Scratch for this, though…