Start 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 pause()
to stop the animation.
Click on the bee to make it stop flying and fall down. Then start a new bee.
// Click on the bee to make it stop flying and fall down. Then start a new bee. 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.play()
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