5f7a8e5301
* update yotta defaults for 16kb devices * refactor deprecated blocks * updates for button events * update button events * update refference * update docs * update docs * update button event blocks * update docs * update block id
1.5 KiB
1.5 KiB
change (Sprite Property)
Change a value for a sprite property by some amount.
game.createSprite(0,0).change(LedSpriteProperty.X, 0);
The value of a sprite propery is changed by using either a positive or negative number. Giving 1
will increase a property value by 1
and giving a -1
will decrease it by 1
.
Parameters
- property: the property of the Sprite you want to change, like:
x
- the change in horizontal location to set the sprite at on the LED screen (0
-4
)y
- the change vertical location to set the sprite at on the LED screen (0
-4
)direction
- the change of direction in degrees for the sprite to go when the next move happens. Direction degree range is from-180
to180
.brightness
- the change in brightness for the LED sprite. Completely dark is0
and very bright is255
.blink
- the change in how fast the sprite is will blink on and off. The blink rate is in milliseconds.
- value: a number value that is the amount of change for the property.
Example
This program makes a sprite on the left side of the screen, waits two seconds (2000 milliseconds), and then moves it to the middle of the screen.
let ball = game.createSprite(0, 2);
basic.pause(2000);
ball.change(LedSpriteProperty.X, 2);