Wrote two new Game topics
This commit is contained in:
parent
1b15eefa5a
commit
37e0307698
@ -1,7 +1,24 @@
|
|||||||
# Move
|
# Move
|
||||||
|
|
||||||
Sprite move by a certain number of LEDs
|
Move the sprite the number of LEDs you say.
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
* ``move by`` is a [number](/reference/types/number) that means how many LEDs the sprite should move
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
This program starts a sprite in the middle of the screen.
|
||||||
|
Next, the sprite turns toward the lower-right corner.
|
||||||
|
Finally, it moves two LEDs away to the corner.
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
let item = game.createSprite(2, 2);
|
||||||
|
item.turn(Direction.Right, 45);
|
||||||
|
item.move(2);
|
||||||
```
|
```
|
||||||
export function move(_this: micro_bitSprites.LedSprite, leds: number)
|
|
||||||
```
|
### See also
|
||||||
|
|
||||||
|
[turn](/reference/game/turn),
|
||||||
|
[create sprite](/reference/game/create-sprite)
|
||||||
|
@ -1,14 +1,28 @@
|
|||||||
# Turn
|
# Turn
|
||||||
|
|
||||||
Rotates a sprite to the right by a certain number of degrees
|
Turn the sprite as much as you say in the direction you say.
|
||||||
|
|
||||||
```
|
### Parameters
|
||||||
export function turnRight(_this: micro_bitSprites.LedSprite, degrees: number)
|
|
||||||
|
* ``turn`` is a choice whether the sprite should turn **left** or **right**
|
||||||
|
* ``by`` is a [number](/reference/types/number) that means how much the sprite should turn.
|
||||||
|
This number is in **degrees**, so a straight left or right turn is 90 degrees.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
|
||||||
|
This program starts a sprite in the middle of the screen.
|
||||||
|
Next, the sprite turns toward the lower-right corner.
|
||||||
|
Finally, it moves two LEDs away to the corner.
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
let item = game.createSprite(2, 2);
|
||||||
|
item.turn(Direction.Right, 45);
|
||||||
|
item.move(2);
|
||||||
```
|
```
|
||||||
|
|
||||||
Rotates a sprite to the left by a certain number of degrees
|
### See also
|
||||||
|
|
||||||
```
|
|
||||||
export function turnLeft(_this: micro_bitSprites.LedSprite, degrees: number)
|
|
||||||
```
|
|
||||||
|
|
||||||
|
[move](/reference/game/move),
|
||||||
|
[create sprite](/reference/game/create-sprite)
|
||||||
|
Loading…
Reference in New Issue
Block a user