The sprite's scalar speed.
The velocity of the sprite, its speed and direction, can be set in many ways:
sprite.x
and sprite.y
properties within the draw()
functionsprite.velocityX
and sprite.velocityY
propertiessprite.setVelocity()
or sprite.setSpeedAndDirection()
Move a sprite in a spiral.
// Move a sprite in a spiral. var sprite = createSprite(200, 100, 20, 20); function draw() { background("white"); drawSprites(); sprite.setSpeedAndDirection(sprite.getSpeed()+0.01,sprite.getDirection()+1); }
sprite.getSpeed()
The speed of the sprite in pixels per frame..
Found a bug in the documentation? Let us know at documentation@code.org