Move Steps
move(10)
// Example: move()
exampleSprite_sprite.whenFlag(function () {
exampleSprite_sprite.show()
while(true){
this.move(10)
this.wait(1)
}
})
Turn Left
turnLeft(15)
// Example: turnLeft()
exampleSprite_sprite.whenFlag(function () {
exampleSprite_sprite.show()
while(true){
this.turnLeft(15)
this.wait(1)
}
})
Turn Right
turnRight(15)
// Example: turnLeft()
exampleSprite_sprite.whenFlag(function () {
exampleSprite_sprite.show()
while(true){
this.turnRight(15)
this.wait(1)
}
})
GoTo
GoTo XY
goTo(55,-35)
exampleSprite_sprite.whenFlag(function () {
exampleSprite_sprite.show()
while(true){
this.goTo(55,-35)
this.wait(0.5)
this.goTo(0,0)
this.wait(0.5)
}
})
GoTo Random Position
goTo(randomRange(-240, 240),randomRange(-180, 180))
exampleSprite_sprite.whenFlag(function () {
exampleSprite_sprite.show()
while (true) {
exampleSprite_sprite.goTo(randomRange(-240, 240),randomRange(-180, 180))
this.wait(0.5)
}
})
GoTo Mouse-Pointer
goTo(stage.mouseX,stage.mouseY)
exampleSprite_sprite.whenFlag(function () {
exampleSprite_sprite.show()
while(true){
this.goTo(stage.mouseX,stage.mouseY)
this.say('mouseX: '+ stage.mouseX + ' mouseY: ' + stage.mouseY)
}
})
GoTo Sprite
goTowards(sprite)
exampleSprite_sprite.whenFlag(function () {
exampleSprite_sprite.show()
this.goTo(-150,-150)
this.wait(1)
apple_sprite.goTowards(exampleSprite_sprite)
})
Glide
Glide To XY
glide(1, 55, -35)
exampleSprite_sprite.whenFlag(function () {
exampleSprite_sprite.show()
while(true){
this.glide(1, 55, -35)
this.glide(1, 0, 0)
}
})
Glide To Random Position
glide(1, randomRange(-240,240), randomRange(-180,180))
exampleSprite_sprite.whenFlag(function () {
exampleSprite_sprite.show()
while(true){
this.glide(1, randomRange(-240,240), randomRange(-180,180))
}
})
Glide To Mouse-Pointer
glide(stage.mouseX,stage.mouseY)
exampleSprite_sprite.whenFlag(function () {
exampleSprite_sprite.show()
while(true){
this.glide(1, stage.mouseX,stage.mouseY)
}
})
Point
Point in Direction
pointInDirection(90)
exampleSprite_sprite.whenFlag(function () {
exampleSprite_sprite.show()
this.pointInDirection(0)
this.wait(1)
this.pointInDirection(90)
})
Point Towards Mouse-Pointer
There is no “point towards mouse-pointer” equivalent. However, you could command a sprite with “goTo”(eg a cross-hair) to move to the mouse-pointer and then point towards that sprite as shown below.
Point Towards Sprite
pointTowards(Sprite1)
ball_sprite.whenFlag(function(){
ball_sprite.show()
while (true){
ball_sprite.goTo(stage.mouseX, stage.mouseY)
}
})
exampleSprite_sprite.whenFlag(function () {
exampleSprite_sprite.show()
while (true) {
exampleSprite_sprite.pointTowards(ball_sprite)
}
})
Change X & Y
changeX(10)
changeY(10)
exampleSprite_sprite.whenFlag(function () {
exampleSprite_sprite.show()
this.wait(0.5)
this.changeX(50)
this.wait(0.5)
this.changeY(50)
})
Set X & Y
setX(55)
setY(-35)
exampleSprite_sprite.whenFlag(function () {
exampleSprite_sprite.show()
this.setX(0)
this.setY(0)
this.wait(0.5)
this.setX(55)
this.wait(0.5)
this.setY(-35)
})
If on Edge Bounce
ifOnEdgeBounce()
ball_sprite.whenFlag(function () {
ball_sprite.show()
while (true){
this.move(10)
this.ifOnEdgeBounce()
}
})
Set Rotation Style
setRotationStyle('left-right')
// 'left-right','all','no'
example_Sprite_sprite.whenFlag(function () {
while (true){
this.setRotationStyle('no')
this.say('rotation: no')
this.wait(5)
this.setRotationStyle('left-right')
this.say('rotation: left-right')
this.wait(5)
this.setRotationStyle('all')
this.say('rotation: all')
this.wait(5)
}
})
example_Sprite_sprite.whenFlag(function () {
example_Sprite_sprite.show()
while (true){
this.move(10)
this.ifOnEdgeBounce()
}
})