Checks if the mouse moved.
Some interactive games use the mouse for the user to control the game.
var count=0;
function draw() {
background("white");
if (mouseDidMove()) {
count=count+1;
}
text("count="+count, 0, 15);
}
// Keep the sprite up by moving the mouse over the sprite.
var sprite = createSprite(200, 200,25,25);
function draw() {
background("white");
if (mouseIsOver(sprite) && mouseDidMove()) {
sprite.y=sprite.y-1;
} else {
sprite.y=sprite.y+1;
}
drawSprites();
}
mouseDidMove()
Boolean true or false.
Found a bug in the documentation? Let us know at documentation@code.org