-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix block help paths and missing ref pages (#1466)
* Add help target ref pages * fix bad or add new help paths
- Loading branch information
Showing
15 changed files
with
412 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# animation Frames | ||
|
||
A sequence of image frames for an animation. | ||
|
||
```sig | ||
animation._animationFrames(null) | ||
``` | ||
|
||
The frames of an animation are set as an array of images. The block for containing the frames provides access to the image editor to create new frames and edit the ones already in the animation. | ||
|
||
## Parameters | ||
|
||
* **frames**: an array of images that create the animation. | ||
|
||
## Example #example | ||
|
||
Create and run an animation of a person walking. Click on the animation frames block to edit the animation. Loop the animation and then | ||
stop it by pressing button **A**. | ||
|
||
```blocks | ||
controller.A.onEvent(ControllerButtonEvent.Pressed, function () { | ||
animation.stopAnimation(animation.AnimationTypes.All, mySprite) | ||
}) | ||
let mySprite: Sprite = null | ||
scene.setBackgroundColor(1) | ||
mySprite = sprites.create(img` | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
`, SpriteKind.Player) | ||
let walker = animation._animationFrames([img` | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
. . . . . . . . . . . . . . . . | ||
`]) | ||
animation.runImageAnimation( | ||
mySprite, | ||
walker, | ||
500, | ||
true | ||
) | ||
``` | ||
|
||
## See Also #seealso | ||
|
||
[run image animation](/reference/animation/run-image-animation), | ||
[run movement animation](/reference/animation/run-movement-animation) | ||
|
||
```package | ||
animation | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# image | ||
|
||
The container and editor block for an image. | ||
|
||
```sig | ||
images._image(null) | ||
``` | ||
|
||
Clicking on the image window in the block will open the image editor and a you can create a new image or edit the current one. The image is used to assign to a sprite or as a frame in an animation. | ||
|
||
## Parameters | ||
|
||
* **image**: The [image](/types/image) to contain in the block. | ||
|
||
## Example #example | ||
|
||
Create a new `food` sprite with an image of a donut. When the game score reaches `100`, upgrade food sprite to the `cake` image. | ||
|
||
```blocks | ||
info.onScore(100, function () { | ||
mySprite.setImage(cake) | ||
}) | ||
let cake: Image = null | ||
let mySprite: Sprite = null | ||
mySprite = sprites.create(img` | ||
. . . . . . b b b b a a . . . . | ||
. . . . b b d d d 3 3 3 a a . . | ||
. . . b d d d 3 3 3 3 3 3 a a . | ||
. . b d d 3 3 3 3 3 3 3 3 3 a . | ||
. b 3 d 3 3 3 3 3 b 3 3 3 3 a b | ||
. b 3 3 3 3 3 a a 3 3 3 3 3 a b | ||
b 3 3 3 3 3 a a 3 3 3 3 d a 4 b | ||
b 3 3 3 3 b a 3 3 3 3 3 d a 4 b | ||
b 3 3 3 3 3 3 3 3 3 3 d a 4 4 e | ||
a 3 3 3 3 3 3 3 3 3 d a 4 4 4 e | ||
a 3 3 3 3 3 3 3 d d a 4 4 4 e . | ||
a a 3 3 3 d d d a a 4 4 4 e e . | ||
. e a a a a a a 4 4 4 4 e e . . | ||
. . e e b b 4 4 4 4 b e e . . . | ||
. . . e e e e e e e e . . . . . | ||
. . . . . . . . . . . . . . . . | ||
`, SpriteKind.Food) | ||
cake = img` | ||
. . . . . . . . . . b b b . . . | ||
. . . . . . . . b e e 3 3 b . . | ||
. . . . . . b b e 3 2 e 3 a . . | ||
. . . . b b 3 3 e 2 2 e 3 3 a . | ||
. . b b 3 3 3 3 3 e e 3 3 3 a . | ||
b b 3 3 3 3 3 3 3 3 3 3 3 3 3 a | ||
b 3 3 3 d d d d 3 3 3 3 3 d d a | ||
b b b b b b b 3 d d d d d d 3 a | ||
b d 5 5 5 5 d b b b a a a a a a | ||
b 3 d d 5 5 5 5 5 5 5 d d d d a | ||
b 3 3 3 3 3 3 d 5 5 5 d d d d a | ||
b 3 d 5 5 5 3 3 3 3 3 3 b b b a | ||
b b b 3 d 5 5 5 5 5 5 5 d d b a | ||
. . . b b b 3 d 5 5 5 5 d d 3 a | ||
. . . . . . b b b b 3 d d d b a | ||
. . . . . . . . . . b b b a a . | ||
` | ||
``` | ||
|
||
## See also | ||
|
||
[create](/reference/images/create) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# equals | ||
|
||
Compare this image to another image to see if they are the same. | ||
|
||
```sig | ||
image.create(0, 0).equals(null) | ||
``` | ||
|
||
Each pixel in the image is compared with another image. If all the pixels in both images are identical, then the images are considered "equal". | ||
|
||
## Parameters | ||
|
||
* **other**: the other image to compare this one to. | ||
|
||
## Returns | ||
|
||
* a [boolean](/types/boolean) value that is `true` if all of the pixels in the two images are identical, or a value of `false` otherwise. | ||
|
||
## Example #example | ||
|
||
Create sprite with using a `burger` image. Create just an image of the same burger using a variable. Compare that image with the image in the sprite to see if they are equal. | ||
|
||
```blocks | ||
let mySprite = sprites.create(img` | ||
. . . . c c c b b b b b . . . . | ||
. . c c b 4 4 4 4 4 4 b b b . . | ||
. c c 4 4 4 4 4 5 4 4 4 4 b c . | ||
. e 4 4 4 4 4 4 4 4 4 5 4 4 e . | ||
e b 4 5 4 4 5 4 4 4 4 4 4 4 b c | ||
e b 4 4 4 4 4 4 4 4 4 4 5 4 4 e | ||
e b b 4 4 4 4 4 4 4 4 4 4 4 b e | ||
. e b 4 4 4 4 4 5 4 4 4 4 b e . | ||
8 7 e e b 4 4 4 4 4 4 b e e 6 8 | ||
8 7 2 e e e e e e e e e e 2 7 8 | ||
e 6 6 2 2 2 2 2 2 2 2 2 2 6 c e | ||
e c 6 7 6 6 7 7 7 6 6 7 6 c c e | ||
e b e 8 8 c c 8 8 c c c 8 e b e | ||
e e b e c c e e e e e c e b e e | ||
. e e b b 4 4 4 4 4 4 4 4 e e . | ||
. . . c c c c c e e e e e . . . | ||
`, SpriteKind.Food) | ||
let burger = img` | ||
. . . . c c c b b b b b . . . . | ||
. . c c b 4 4 4 4 4 4 b b b . . | ||
. c c 4 4 4 4 4 5 4 4 4 4 b c . | ||
. e 4 4 4 4 4 4 4 4 4 5 4 4 e . | ||
e b 4 5 4 4 5 4 4 4 4 4 4 4 b c | ||
e b 4 4 4 4 4 4 4 4 4 4 5 4 4 e | ||
e b b 4 4 4 4 4 4 4 4 4 4 4 b e | ||
. e b 4 4 4 4 4 5 4 4 4 4 b e . | ||
8 7 e e b 4 4 4 4 4 4 b e e 6 8 | ||
8 7 2 e e e e e e e e e e 2 7 8 | ||
e 6 6 2 2 2 2 2 2 2 2 2 2 6 c e | ||
e c 6 7 6 6 7 7 7 6 6 7 6 c c e | ||
e b e 8 8 c c 8 8 c c c 8 e b e | ||
e e b e c c e e e e e c e b e e | ||
. e e b b 4 4 4 4 4 4 4 4 e e . | ||
. . . c c c c c e e e e e . . . | ||
` | ||
if (burger.equals(mySprite.image)) { | ||
mySprite.sayText("I'm a burger!", 2000, false) | ||
} | ||
``` | ||
|
||
## See Also #seealso | ||
|
||
[clone](/reference/images/image/clone), | ||
[get pixel](/reference/images/image/get-pixel) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# sprite Image | ||
|
||
The container and editor block for a sprite image. | ||
|
||
```sig | ||
images._spriteImage(null) | ||
``` | ||
|
||
Clicking on the image window in the block will open the image editor and a you can create a new image or edit the current one. The image is used when a sprite is created or as a different image to assign to a sprite. | ||
|
||
## Parameters | ||
|
||
* **image**: The [image](/types/image) to use for a sprite. | ||
|
||
## Example #example | ||
|
||
Create a new sprite with an image of a donut. | ||
|
||
```blocks | ||
let mySprite = sprites.create(img` | ||
. . . . . . b b b b a a . . . . | ||
. . . . b b d d d 3 3 3 a a . . | ||
. . . b d d d 3 3 3 3 3 3 a a . | ||
. . b d d 3 3 3 3 3 3 3 3 3 a . | ||
. b 3 d 3 3 3 3 3 b 3 3 3 3 a b | ||
. b 3 3 3 3 3 a a 3 3 3 3 3 a b | ||
b 3 3 3 3 3 a a 3 3 3 3 d a 4 b | ||
b 3 3 3 3 b a 3 3 3 3 3 d a 4 b | ||
b 3 3 3 3 3 3 3 3 3 3 d a 4 4 e | ||
a 3 3 3 3 3 3 3 3 3 d a 4 4 4 e | ||
a 3 3 3 3 3 3 3 d d a 4 4 4 e . | ||
a a 3 3 3 d d d a a 4 4 4 e e . | ||
. e a a a a a a 4 4 4 4 e e . . | ||
. . e e b b 4 4 4 4 b e e . . . | ||
. . . e e e e e e e e . . . . . | ||
. . . . . . . . . . . . . . . . | ||
`, SpriteKind.Food) | ||
``` | ||
|
||
## See also | ||
|
||
[create](/reference/sprites/create), | ||
[set image](/reference/sprites/sprite/set-image) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# change Countdown By | ||
|
||
Change the current game countdown time up or down by this amount. | ||
|
||
```sig | ||
info.changeCountdownBy(0) | ||
``` | ||
|
||
The current game countdown time amount is increased by adding the change value when it is greater than zero (positive). If the change number is less than zero (negative), the game countdown is reduced by the value of the change number. | ||
|
||
## Parameters | ||
|
||
* **value**: a [number](/types/number) seconds to change the game countdown by. | ||
|
||
## Example #example | ||
|
||
Reduce game countdown time by `3` seconds. | ||
|
||
```blocks | ||
info.changeCountdown(-3) | ||
``` | ||
|
||
## See also #seealso | ||
|
||
[countdown](/reference/info/score), | ||
[on countdown end](/reference/info/on-countdown-end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# countdown | ||
|
||
Get the current game countdown time. | ||
|
||
```sig | ||
info.changeCountdownBy(0) | ||
``` | ||
|
||
The current game countdown time amount is increased by adding the change value when it is greater than zero (positive). If the change number is less than zero (negative), the game countdown is reduced by the value of the change number. | ||
|
||
## Parameters | ||
|
||
* **value**: a [number](/types/number) to set the game countdown by. | ||
|
||
## Returns | ||
|
||
* a [number](/types/number) that is the amount of time remaining for the game countdown in seconds. | ||
|
||
## Example #example | ||
|
||
Give a sprite warning message when the game countdown time is less than `5` seconds. | ||
|
||
```blocks | ||
info.startCountdown(30) | ||
let mySprite = sprites.create(img` | ||
. . . . . . . . . . . . . . . . | ||
. . 4 4 4 . . . . 4 4 4 . . . . | ||
. 4 5 5 5 e . . e 5 5 5 4 . . . | ||
4 5 5 5 5 5 e e 5 5 5 5 5 4 . . | ||
4 5 5 4 4 5 5 5 5 4 4 5 5 4 . . | ||
e 5 4 4 5 5 5 5 5 5 4 4 5 e . . | ||
. e e 5 5 5 5 5 5 5 5 e e . . . | ||
. . e 5 f 5 5 5 5 f 5 e . . . . | ||
. . f 5 5 5 4 4 5 5 5 f . f f . | ||
. . . 4 5 5 f f 5 5 6 f f 5 f . | ||
. . . f 6 6 6 6 6 6 4 f 5 5 f . | ||
. . . f 5 5 5 5 5 5 5 4 5 f . . | ||
. . . . f 5 4 5 f 5 f f f . . . | ||
. . . . . f f f f f f f . . . . | ||
`, SpriteKind.Player) | ||
game.onUpdateInterval(500, function () { | ||
if (info.countdown() < 5) { | ||
mySprite.sayText("Short on time!") | ||
} | ||
}) | ||
``` | ||
|
||
## See also #seealso | ||
|
||
[start countdown](/reference/info/start-countdown), | ||
[change countdown by](/reference/info/change-countdown-by), | ||
[on countdown end](/reference/info/on-countdown-end) |
Oops, something went wrong.