Skip to content

Commit

Permalink
Fix block help paths and missing ref pages (#1466)
Browse files Browse the repository at this point in the history
* Add help target ref pages

* fix bad or add new help paths
  • Loading branch information
ganicke authored Dec 20, 2023
1 parent f311c0e commit df39c29
Show file tree
Hide file tree
Showing 15 changed files with 412 additions and 7 deletions.
77 changes: 77 additions & 0 deletions libs/game/docs/reference/animation/animation-frames.md
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
```
65 changes: 65 additions & 0 deletions libs/game/docs/reference/images/image.md
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)
68 changes: 68 additions & 0 deletions libs/game/docs/reference/images/image/equals.md
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)
43 changes: 43 additions & 0 deletions libs/game/docs/reference/images/sprite-image.md
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)
26 changes: 26 additions & 0 deletions libs/game/docs/reference/info/change-countdown-by.md
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)
2 changes: 1 addition & 1 deletion libs/game/docs/reference/info/change-score-by.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The total score amount is increased by adding the change value when it is greate

## Parameters

* **value**: a [number](/types/number) to set the current score to.
* **value**: a [number](/types/number) whice is the amount to change the current score by.

## Example #example

Expand Down
52 changes: 52 additions & 0 deletions libs/game/docs/reference/info/countdown.md
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)
Loading

0 comments on commit df39c29

Please sign in to comment.