Pause the automatic frame advance for the animation for a sprite.
Use the Animation tab to load multiple images which make up the frames for a labeled animation for your sprite. By default all frames are displayed one after another in round robin fashion. The speed is set by the slider in the Animation tab. Use play()
to restart the animation.
Click on the bee to make it stop flying and fall down.
// Click on the bee to make it stop flying and fall down. createEdgeSprites(); var sprite = createSprite(200, 200); sprite.setAnimation("bee_1"); sprite.x = 400; sprite.y = randomNumber(0, 400); sprite.velocityX = randomNumber(-5, -1); function draw() { background("white"); drawSprites(); if (mousePressedOver(sprite)) { sprite.pause(); sprite.velocityX = 0; sprite.velocityY = 5; } if (sprite.x < 0 || sprite.y > 400) { sprite.play(); sprite.x = 400; sprite.y = randomNumber(0, 400); sprite.velocityX = randomNumber(-5, -1); sprite.velocityY = 0; } }
sprite.pause()
No return value. Changes output in the display after drawSprites() is called.
drawSprites()
is called.Found a bug in the documentation? Let us know at documentation@code.org