pxt-common-packages 9.3.12 → 9.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/built/common-sim.js +8 -6
- package/libs/azureiot/built/debug/binary.js +469 -464
- package/libs/color/built/debug/binary.js +8 -8
- package/libs/color-sensor/built/debug/binary.js +8 -8
- package/libs/controller/built/debug/binary.js +7126 -6975
- package/libs/controller---none/built/debug/binary.js +7105 -6954
- package/libs/core---esp32/pins.cpp +30 -4
- package/libs/core---esp32/shims.d.ts +15 -0
- package/libs/core---esp32s2/shims.d.ts +15 -0
- package/libs/datalogger/built/debug/binary.js +63 -63
- package/libs/edge-connector/built/debug/binary.js +8 -8
- package/libs/esp32/built/debug/binary.js +470 -465
- package/libs/game/_locales/game-jsdoc-strings.json +10 -1
- package/libs/game/_locales/game-strings.json +18 -2
- package/libs/game/assetTemplates.ts +2 -0
- package/libs/game/built/debug/binary.js +7018 -6867
- package/libs/game/docs/reference/scene/get-tile-location.md +96 -0
- package/libs/game/docs/reference/scene/get-tiles-by-type.md +64 -43
- package/libs/game/docs/reference/scene/is-hitting-tile.md +87 -0
- package/libs/game/docs/reference/scene/on-hit-wall.md +88 -0
- package/libs/game/docs/reference/scene/on-overlap-tile.md +88 -0
- package/libs/game/docs/reference/scene/place-on-random-tile.md +95 -41
- package/libs/game/docs/reference/scene/place-on-tile.md +88 -0
- package/libs/game/docs/reference/scene/set-tile-at.md +45 -41
- package/libs/game/docs/reference/scene/set-tilemap.md +89 -0
- package/libs/game/docs/reference/scene/set-wall-at.md +86 -0
- package/libs/game/docs/reference/scene/tile-at-location-equals.md +97 -0
- package/libs/game/docs/reference/scene/tile-kind-at.md +118 -0
- package/libs/game/docs/reference/scene.md +20 -16
- package/libs/game/physics.ts +1 -1
- package/libs/game/scenes.ts +5 -1
- package/libs/game/sprite.ts +23 -6
- package/libs/game/spriteevents.ts +7 -7
- package/libs/game/sprites.ts +16 -0
- package/libs/game/tilemap.ts +173 -27
- package/libs/lcd/built/debug/binary.js +8 -8
- package/libs/light-spectrum-sensor/built/debug/binary.js +8 -8
- package/libs/lora/built/debug/binary.js +8 -8
- package/libs/matrix-keypad/built/debug/binary.js +8 -8
- package/libs/mqtt/built/debug/binary.js +176 -176
- package/libs/net/built/debug/binary.js +176 -176
- package/libs/net/controller.ts +15 -1
- package/libs/net-game/built/debug/binary.js +8896 -8680
- package/libs/palette/built/debug/binary.js +7017 -6866
- package/libs/pixel/built/debug/binary.js +8 -8
- package/libs/power/built/debug/binary.js +8 -8
- package/libs/proximity/built/debug/binary.js +8 -8
- package/libs/radio/built/debug/binary.js +8 -8
- package/libs/radio-broadcast/built/debug/binary.js +8 -8
- package/libs/rotary-encoder/built/debug/binary.js +8 -8
- package/libs/screen/built/debug/binary.js +50 -50
- package/libs/screen/image.cpp +9 -7
- package/libs/screen/sim/image.ts +9 -7
- package/libs/servo/built/debug/binary.js +8 -8
- package/libs/storyboard/built/debug/binary.js +7017 -6866
- package/package.json +1 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# place On Tile
|
|
2
|
+
|
|
3
|
+
Move a sprite's position to the center of a tile location in the tilemap.
|
|
4
|
+
|
|
5
|
+
```sig
|
|
6
|
+
tiles.placeOnTile(null, tiles.getTileLocation(0, 0))
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
A sprite will locate itself on top of a tile in the tilemap using a tilemap location object. A location object contains a tile row value and a tile column value.
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
* **sprite**: the sprite to move onto the tile.
|
|
14
|
+
* **loc**: a tile location in the tilemap.
|
|
15
|
+
|
|
16
|
+
## Example #example
|
|
17
|
+
|
|
18
|
+
Make a grid tilemap with two tile colors. Create a round shaped sprite. Ramdomly place the sprite on a tile in the grid.
|
|
19
|
+
|
|
20
|
+
```blocks
|
|
21
|
+
tiles.setTilemap(tilemap`level1`)
|
|
22
|
+
let mySprite = sprites.create(img`
|
|
23
|
+
. . . . . . . . . . . . . . . .
|
|
24
|
+
. . . . . . . . . . . . . . . .
|
|
25
|
+
. . . . . 7 7 7 7 7 7 . . . . .
|
|
26
|
+
. . . 7 7 7 7 7 7 7 7 7 7 . . .
|
|
27
|
+
. . . 7 7 7 7 7 7 7 7 7 7 . . .
|
|
28
|
+
. . 7 7 7 7 7 7 7 7 7 7 7 7 . .
|
|
29
|
+
. . 7 7 7 7 7 7 7 7 7 7 7 7 . .
|
|
30
|
+
. . 7 7 7 7 7 7 7 7 7 7 7 7 . .
|
|
31
|
+
. . 7 7 7 7 7 7 7 7 7 7 7 7 . .
|
|
32
|
+
. . 7 7 7 7 7 7 7 7 7 7 7 7 . .
|
|
33
|
+
. . 7 7 7 7 7 7 7 7 7 7 7 7 . .
|
|
34
|
+
. . . 7 7 7 7 7 7 7 7 7 7 . . .
|
|
35
|
+
. . . 7 7 7 7 7 7 7 7 7 7 . . .
|
|
36
|
+
. . . . . 7 7 7 7 7 7 . . . . .
|
|
37
|
+
. . . . . . . . . . . . . . . .
|
|
38
|
+
. . . . . . . . . . . . . . . .
|
|
39
|
+
`, SpriteKind.Player)
|
|
40
|
+
|
|
41
|
+
forever(function () {
|
|
42
|
+
tiles.placeOnTile(mySprite, tiles.getTileLocation(randint(0, 9), randint(0, 6)))
|
|
43
|
+
pause(500)
|
|
44
|
+
})
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## See also #seealso
|
|
48
|
+
|
|
49
|
+
[get tile location](/reference/scene/get-tile-location),
|
|
50
|
+
[place on random tile](/reference/scene/place-on-random-tile)
|
|
51
|
+
|
|
52
|
+
```jres
|
|
53
|
+
{
|
|
54
|
+
"transparency16": {
|
|
55
|
+
"data": "hwQQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
56
|
+
"mimeType": "image/x-mkcd-f4",
|
|
57
|
+
"tilemapTile": true
|
|
58
|
+
},
|
|
59
|
+
"tile1": {
|
|
60
|
+
"data": "hwQQABAAAADd3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3Q==",
|
|
61
|
+
"mimeType": "image/x-mkcd-f4",
|
|
62
|
+
"tilemapTile": true,
|
|
63
|
+
"displayName": "myTile"
|
|
64
|
+
},
|
|
65
|
+
"tile2": {
|
|
66
|
+
"data": "hwQQABAAAABVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVQ==",
|
|
67
|
+
"mimeType": "image/x-mkcd-f4",
|
|
68
|
+
"tilemapTile": true,
|
|
69
|
+
"displayName": "myTile0"
|
|
70
|
+
},
|
|
71
|
+
"level1": {
|
|
72
|
+
"id": "level1",
|
|
73
|
+
"mimeType": "application/mkcd-tilemap",
|
|
74
|
+
"data": "MTAwYTAwMDgwMDAxMDIwMTAyMDEwMjAxMDIwMTAyMDIwMTAyMDEwMjAxMDIwMTAyMDEwMTAyMDEwMjAxMDIwMTAyMDEwMjAyMDEwMjAxMDIwMTAyMDEwMjAxMDEwMjAxMDIwMTAyMDEwMjAxMDIwMjAxMDIwMTAyMDEwMjAxMDIwMTAxMDIwMTAyMDEwMjAxMDIwMTAyMDIwMTAyMDEwMjAxMDIwMTAyMDEwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMA==",
|
|
75
|
+
"tileset": [
|
|
76
|
+
"myTiles.transparency16",
|
|
77
|
+
"myTiles.tile1",
|
|
78
|
+
"myTiles.tile2"
|
|
79
|
+
],
|
|
80
|
+
"displayName": "level1"
|
|
81
|
+
},
|
|
82
|
+
"*": {
|
|
83
|
+
"mimeType": "image/x-mkcd-f4",
|
|
84
|
+
"dataEncoding": "base64",
|
|
85
|
+
"namespace": "myTiles"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
@@ -1,61 +1,65 @@
|
|
|
1
1
|
# set Tile At
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Set a tile at a location in the tilemap.
|
|
4
4
|
|
|
5
5
|
```sig
|
|
6
|
-
|
|
6
|
+
tiles.setTileAt(null, tiles.getTileLocation(0, 0))
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
You can set a tile at a specific column and row in the tilemap using a tile location object. Specify a tile to set in the tilemap and a location for it.
|
|
10
10
|
|
|
11
11
|
## Parameters
|
|
12
12
|
|
|
13
|
-
* **tile**: the
|
|
14
|
-
* **
|
|
13
|
+
* **tile**: the to set in the tilemap.
|
|
14
|
+
* **loc**: a tile location in the tilemap.
|
|
15
15
|
|
|
16
16
|
## Example #example
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
Create an empty tilemap and a solid color tile. Set the solid color tile at different places in the tilemap and replace its previous location with a transparent tile.
|
|
19
19
|
|
|
20
20
|
```blocks
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
a a a a a a a a a a a a a a a a
|
|
30
|
-
a a a a a a a a a a a a a a a a
|
|
31
|
-
a a a a a a a a a a a a a a a a
|
|
32
|
-
a a a a a a a a a a a a a a a a
|
|
33
|
-
a a a a a a a a a a a a a a a a
|
|
34
|
-
a a a a a a a a a a a a a a a a
|
|
35
|
-
a a a a a a a a a a a a a a a a
|
|
36
|
-
a a a a a a a a a a a a a a a a
|
|
37
|
-
a a a a a a a a a a a a a a a a
|
|
38
|
-
`)
|
|
39
|
-
scene.setTileMap(img`
|
|
40
|
-
2 2 2 2 2 2 2 2 2 2
|
|
41
|
-
2 . . . . . . . . 2
|
|
42
|
-
2 . . . . . . . . 2
|
|
43
|
-
2 . . . 1 1 . . . 2
|
|
44
|
-
2 . . . . . . . . 2
|
|
45
|
-
2 . . . . . . . . 2
|
|
46
|
-
2 2 2 2 2 2 2 2 2 2
|
|
47
|
-
. . . . . . . . . .
|
|
48
|
-
`)
|
|
49
|
-
pause(1000)
|
|
50
|
-
scene.setTileAt(scene.getTile(4, 3), 2)
|
|
51
|
-
pause(1000)
|
|
52
|
-
scene.setTileAt(scene.getTile(5, 3), 2)
|
|
21
|
+
tiles.setTilemap(tilemap`level1`)
|
|
22
|
+
let spot = tiles.getTileLocation(0, 0)
|
|
23
|
+
forever(function () {
|
|
24
|
+
tiles.setTileAt(spot, assets.tile`transparency16`)
|
|
25
|
+
spot = tiles.getTileLocation(randint(0, 9), randint(0, 6))
|
|
26
|
+
tiles.setTileAt(spot, assets.tile`myTile`)
|
|
27
|
+
pause(1000)
|
|
28
|
+
})
|
|
53
29
|
```
|
|
54
30
|
|
|
55
31
|
## See also #seealso
|
|
56
32
|
|
|
57
|
-
[
|
|
33
|
+
[get tile location](/reference/scene/get-tile-location),
|
|
34
|
+
[place on tile](/reference/scene/place-on-tile)
|
|
58
35
|
|
|
59
|
-
```
|
|
60
|
-
|
|
36
|
+
```jres
|
|
37
|
+
{
|
|
38
|
+
"transparency16": {
|
|
39
|
+
"data": "hwQQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
40
|
+
"mimeType": "image/x-mkcd-f4",
|
|
41
|
+
"tilemapTile": true
|
|
42
|
+
},
|
|
43
|
+
"tile1": {
|
|
44
|
+
"data": "hwQQABAAAABERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERA==",
|
|
45
|
+
"mimeType": "image/x-mkcd-f4",
|
|
46
|
+
"tilemapTile": true,
|
|
47
|
+
"displayName": "myTile"
|
|
48
|
+
},
|
|
49
|
+
"level1": {
|
|
50
|
+
"id": "level1",
|
|
51
|
+
"mimeType": "application/mkcd-tilemap",
|
|
52
|
+
"data": "MTAwYTAwMDgwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMA==",
|
|
53
|
+
"tileset": [
|
|
54
|
+
"myTiles.transparency16",
|
|
55
|
+
"myTiles.tile1"
|
|
56
|
+
],
|
|
57
|
+
"displayName": "level1"
|
|
58
|
+
},
|
|
59
|
+
"*": {
|
|
60
|
+
"mimeType": "image/x-mkcd-f4",
|
|
61
|
+
"dataEncoding": "base64",
|
|
62
|
+
"namespace": "myTiles"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
61
65
|
```
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# set Tilemap
|
|
2
|
+
|
|
3
|
+
Set a tilemap as the current tilemap for the game scene.
|
|
4
|
+
|
|
5
|
+
```sig
|
|
6
|
+
tiles.setTilemap(null)
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
A tilemap is complex data object that contains the dimensions, layers, and tile list for a tile mapping to set as the scene for a game. A game program can have more than one tilemap defined and the game's scene or _level_ can change by setting a different tilemap at certain times during a game.
|
|
10
|
+
|
|
11
|
+
Tilemaps aren't coded by the user but are created using a tilemap editor. Each tilemap in a game project is a named resource and is contained within the project's **assets** collection. A particular tilemap is specified with it's resource name like this:
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
tiles.setTilemap(tilemap`level1`)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
* **tilemap**: the tilemap data containing the tilemap layout and tiles to set for the game scene. The tilemap can be specified by it's resource name, such as: `` tilemap`level1` ``.
|
|
20
|
+
|
|
21
|
+
## Example #example
|
|
22
|
+
|
|
23
|
+
Create a maze tilemap for a sprite to travel through. Set the tilemap as the scene for the game. Create a sprite and start it travelling in the maze.
|
|
24
|
+
|
|
25
|
+
```blocks
|
|
26
|
+
tiles.setTilemap(tilemap`level1`)
|
|
27
|
+
let mySprite = sprites.create(img`
|
|
28
|
+
. . . . . . . . . . . . . . . .
|
|
29
|
+
. . . . . . . . . . . . . . . .
|
|
30
|
+
. . . . . 5 5 5 5 5 5 . . . . .
|
|
31
|
+
. . . 5 5 5 5 5 5 5 5 5 5 . . .
|
|
32
|
+
. . . 5 5 5 5 5 5 5 5 5 5 . . .
|
|
33
|
+
. . 5 5 5 5 5 5 5 5 5 5 5 5 . .
|
|
34
|
+
. . 5 5 5 5 5 5 5 5 5 5 5 5 . .
|
|
35
|
+
. . 5 5 5 5 5 5 5 5 5 5 5 5 . .
|
|
36
|
+
. . 5 5 5 5 5 5 5 5 5 5 5 5 . .
|
|
37
|
+
. . 5 5 5 5 5 5 5 5 5 5 5 5 . .
|
|
38
|
+
. . 5 5 5 5 5 5 5 5 5 5 5 5 . .
|
|
39
|
+
. . . 5 5 5 5 5 5 5 5 5 5 . . .
|
|
40
|
+
. . . 5 5 5 5 5 5 5 5 5 5 . . .
|
|
41
|
+
. . . . . 5 5 5 5 5 5 . . . . .
|
|
42
|
+
. . . . . . . . . . . . . . . .
|
|
43
|
+
. . . . . . . . . . . . . . . .
|
|
44
|
+
`, SpriteKind.Player)
|
|
45
|
+
mySprite.setPosition(0, 104)
|
|
46
|
+
mySprite.vx = 16
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## See also #seealso
|
|
50
|
+
|
|
51
|
+
[set tile at](/reference/scene/set-tile-at)
|
|
52
|
+
|
|
53
|
+
```jres
|
|
54
|
+
{
|
|
55
|
+
"transparency16": {
|
|
56
|
+
"data": "hwQQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
57
|
+
"mimeType": "image/x-mkcd-f4",
|
|
58
|
+
"tilemapTile": true
|
|
59
|
+
},
|
|
60
|
+
"tile1": {
|
|
61
|
+
"data": "hwQQABAAAADu7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7g==",
|
|
62
|
+
"mimeType": "image/x-mkcd-f4",
|
|
63
|
+
"tilemapTile": true,
|
|
64
|
+
"displayName": "myTile0"
|
|
65
|
+
},
|
|
66
|
+
"tile2": {
|
|
67
|
+
"data": "hwQQABAAAABERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERA==",
|
|
68
|
+
"mimeType": "image/x-mkcd-f4",
|
|
69
|
+
"tilemapTile": true,
|
|
70
|
+
"displayName": "myTile1"
|
|
71
|
+
},
|
|
72
|
+
"level1": {
|
|
73
|
+
"id": "level1",
|
|
74
|
+
"mimeType": "application/mkcd-tilemap",
|
|
75
|
+
"data": "MTAwYTAwMDgwMDAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMDAwMDAwMDAwMDAwMDAwMDEwMTAwMDIwMjAyMDAwMjAyMDAwMTAxMDAwMjAwMDIwMDAyMDIwMDAwMDEwMDAyMDAwMjAwMDIwMDAwMDEwMTAwMDIwMDAyMDIwMjAwMDIwMTAwMDAwMDAwMDAwMDAyMDAwMDAxMDEwMTAxMDEwMTAxMDEwMTAxMDEyMjIyMjIyMjIyMDIwMDAwMDAyMDAyMjIwMjIyMjAwMjAyMDIyMjAwMDIwMjAyMDIyMDAyMDIyMjAyMjIwMDAwMDAwMjIwMjIyMjIyMjIyMg==",
|
|
76
|
+
"tileset": [
|
|
77
|
+
"myTiles.transparency16",
|
|
78
|
+
"myTiles.tile1",
|
|
79
|
+
"myTiles.tile2"
|
|
80
|
+
],
|
|
81
|
+
"displayName": "maze"
|
|
82
|
+
},
|
|
83
|
+
"*": {
|
|
84
|
+
"mimeType": "image/x-mkcd-f4",
|
|
85
|
+
"dataEncoding": "base64",
|
|
86
|
+
"namespace": "myTiles"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# set Wall At
|
|
2
|
+
|
|
3
|
+
Set a tile as a wall tile in the tilemap.
|
|
4
|
+
|
|
5
|
+
```sig
|
|
6
|
+
tiles.setWallAt(tiles.getTileLocation(0, 0), false)
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Wall tiles create a barrier for sprites so that they can't pass through tilemap at the tile location. You can set a tile location in the tilemap as a wall or turn it back to a regular tile.
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
* **loc**: a tile location in the tilemap.
|
|
14
|
+
* **on**: a [boolean](/types/boolean) value to set the tile location be a wall tile if `true` or a regular tile if `false`.
|
|
15
|
+
|
|
16
|
+
## Example #example
|
|
17
|
+
|
|
18
|
+
Make a column of tiles from top to bottom of the screen. Set a sprite in motion and set it to bounce on walls. Every `5` seconds, set the tiles in the column to be wall tiles or regular tiles.
|
|
19
|
+
|
|
20
|
+
```blocks
|
|
21
|
+
let isWall = false
|
|
22
|
+
tiles.setTilemap(tilemap`level1`)
|
|
23
|
+
let mySprite = sprites.create(img`
|
|
24
|
+
. . . . . . . . . . . . . . . .
|
|
25
|
+
. . . . . . . . . . . . . . . .
|
|
26
|
+
. . . . . 1 1 1 1 1 1 . . . . .
|
|
27
|
+
. . . 1 1 2 2 2 2 2 2 1 1 . . .
|
|
28
|
+
. . . 1 2 2 2 2 2 2 2 2 1 . . .
|
|
29
|
+
. . 1 2 2 2 2 2 2 2 2 2 2 1 . .
|
|
30
|
+
. . 1 2 2 2 2 2 2 2 2 2 2 1 . .
|
|
31
|
+
. . 1 2 2 2 2 2 2 2 2 2 2 1 . .
|
|
32
|
+
. . 1 2 2 2 2 2 2 2 2 2 2 1 . .
|
|
33
|
+
. . 1 2 2 2 2 2 2 2 2 2 2 1 . .
|
|
34
|
+
. . 1 2 2 2 2 2 2 2 2 2 2 1 . .
|
|
35
|
+
. . . 1 2 2 2 2 2 2 2 2 1 . . .
|
|
36
|
+
. . . 1 1 2 2 2 2 2 2 1 1 . . .
|
|
37
|
+
. . . . . 1 1 1 1 1 1 . . . . .
|
|
38
|
+
. . . . . . . . . . . . . . . .
|
|
39
|
+
. . . . . . . . . . . . . . . .
|
|
40
|
+
`, SpriteKind.Player)
|
|
41
|
+
mySprite.setBounceOnWall(true)
|
|
42
|
+
mySprite.vx = 80
|
|
43
|
+
mySprite.vy = 70
|
|
44
|
+
game.onUpdateInterval(5000, function () {
|
|
45
|
+
isWall = !(isWall)
|
|
46
|
+
for (let wallTile of tiles.getTilesByType(assets.tile`myTile`)) {
|
|
47
|
+
tiles.setWallAt(wallTile, isWall)
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## See also #seealso
|
|
53
|
+
|
|
54
|
+
[get tile location](/reference/scene/get-tile-location),
|
|
55
|
+
[on hit wall](/reference/scene/on-hit-wall)
|
|
56
|
+
|
|
57
|
+
```jres
|
|
58
|
+
{
|
|
59
|
+
"transparency16": {
|
|
60
|
+
"data": "hwQQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
61
|
+
"mimeType": "image/x-mkcd-f4",
|
|
62
|
+
"tilemapTile": true
|
|
63
|
+
},
|
|
64
|
+
"tile1": {
|
|
65
|
+
"data": "hwQQABAAAADu7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7g==",
|
|
66
|
+
"mimeType": "image/x-mkcd-f4",
|
|
67
|
+
"tilemapTile": true,
|
|
68
|
+
"displayName": "myTile"
|
|
69
|
+
},
|
|
70
|
+
"level1": {
|
|
71
|
+
"id": "level1",
|
|
72
|
+
"mimeType": "application/mkcd-tilemap",
|
|
73
|
+
"data": "MTAwYTAwMDgwMDAwMDAwMDAwMDEwMDAwMDAwMDAwMDAwMDAwMDAwMDAxMDAwMDAwMDAwMDAwMDAwMDAxMDAwMDAwMDAwMDAwMDAwMDAwMDAwMTAwMDAwMDAwMDAwMDAwMDAwMTAwMDAwMDAwMDAwMDAwMDAwMDAwMDEwMDAwMDAwMDAwMDAwMDAwMDEwMDAwMDAwMDAwMDAwMDAwMDAwMDAxMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMA==",
|
|
74
|
+
"tileset": [
|
|
75
|
+
"myTiles.transparency16",
|
|
76
|
+
"myTiles.tile1"
|
|
77
|
+
],
|
|
78
|
+
"displayName": "level1"
|
|
79
|
+
},
|
|
80
|
+
"*": {
|
|
81
|
+
"mimeType": "image/x-mkcd-f4",
|
|
82
|
+
"dataEncoding": "base64",
|
|
83
|
+
"namespace": "myTiles"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# tile At Location Equals
|
|
2
|
+
|
|
3
|
+
Check if a location in the tilemap contains the tile you're looking for.
|
|
4
|
+
|
|
5
|
+
```sig
|
|
6
|
+
tiles.tileAtLocationEquals(location, null)
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Parameters
|
|
10
|
+
|
|
11
|
+
* **location**: a location in the tilemap.
|
|
12
|
+
* **tile**: an [image](/types/image) that matches the tile you're looking for.
|
|
13
|
+
|
|
14
|
+
## Returns
|
|
15
|
+
|
|
16
|
+
* a [boolean](/types/boolean) value that is `true` if the tile at **location** matches the **tile** you want to check for. If not, `false` is returned.
|
|
17
|
+
|
|
18
|
+
## Example #example
|
|
19
|
+
|
|
20
|
+
Make a tilemap with two columns of wall tiles with a different color for each. Set a sprite in motion and cause it to bounce on walls. When the sprite contacts a tile, check to see what color the tile is.
|
|
21
|
+
|
|
22
|
+
```blocks
|
|
23
|
+
scene.onHitWall(SpriteKind.Player, function (sprite, location) {
|
|
24
|
+
if (tiles.tileAtLocationEquals(location, assets.tile`myTile0`)) {
|
|
25
|
+
mySprite.sayText("Blue", 500, false)
|
|
26
|
+
} else if (tiles.tileAtLocationEquals(location, assets.tile`myTile1`)) {
|
|
27
|
+
mySprite.sayText("Green", 500, false)
|
|
28
|
+
} else {
|
|
29
|
+
mySprite.startEffect(effects.fire, 200)
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
let mySprite: Sprite = null
|
|
33
|
+
tiles.setTilemap(tilemap`level1`)
|
|
34
|
+
mySprite = sprites.create(img`
|
|
35
|
+
. . . . . . . . . . . . . . . .
|
|
36
|
+
. . . . . . . . . . . . . . . .
|
|
37
|
+
. . . . . 1 1 1 1 1 1 . . . . .
|
|
38
|
+
. . . 1 1 2 2 2 2 2 2 1 1 . . .
|
|
39
|
+
. . . 1 2 2 2 2 2 2 2 2 1 . . .
|
|
40
|
+
. . 1 2 2 2 2 2 2 2 2 2 2 1 . .
|
|
41
|
+
. . 1 2 2 2 2 2 2 2 2 2 2 1 . .
|
|
42
|
+
. . 1 2 2 2 2 2 2 2 2 2 2 1 . .
|
|
43
|
+
. . 1 2 2 2 2 2 2 2 2 2 2 1 . .
|
|
44
|
+
. . 1 2 2 2 2 2 2 2 2 2 2 1 . .
|
|
45
|
+
. . 1 2 2 2 2 2 2 2 2 2 2 1 . .
|
|
46
|
+
. . . 1 2 2 2 2 2 2 2 2 1 . . .
|
|
47
|
+
. . . 1 1 2 2 2 2 2 2 1 1 . . .
|
|
48
|
+
. . . . . 1 1 1 1 1 1 . . . . .
|
|
49
|
+
. . . . . . . . . . . . . . . .
|
|
50
|
+
. . . . . . . . . . . . . . . .
|
|
51
|
+
`, SpriteKind.Player)
|
|
52
|
+
mySprite.setBounceOnWall(true)
|
|
53
|
+
mySprite.vx = 40
|
|
54
|
+
mySprite.vy = 35
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## See also #seealso
|
|
58
|
+
|
|
59
|
+
[get tile location](/reference/scene/get-tile-location)
|
|
60
|
+
|
|
61
|
+
```jres
|
|
62
|
+
{
|
|
63
|
+
"transparency16": {
|
|
64
|
+
"data": "hwQQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
65
|
+
"mimeType": "image/x-mkcd-f4",
|
|
66
|
+
"tilemapTile": true
|
|
67
|
+
},
|
|
68
|
+
"tile1": {
|
|
69
|
+
"data": "hwQQABAAAACIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiA==",
|
|
70
|
+
"mimeType": "image/x-mkcd-f4",
|
|
71
|
+
"tilemapTile": true,
|
|
72
|
+
"displayName": "myTile0"
|
|
73
|
+
},
|
|
74
|
+
"tile2": {
|
|
75
|
+
"data": "hwQQABAAAAB3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3dw==",
|
|
76
|
+
"mimeType": "image/x-mkcd-f4",
|
|
77
|
+
"tilemapTile": true,
|
|
78
|
+
"displayName": "myTile1"
|
|
79
|
+
},
|
|
80
|
+
"level1": {
|
|
81
|
+
"id": "level1",
|
|
82
|
+
"mimeType": "application/mkcd-tilemap",
|
|
83
|
+
"data": "MTAwYTAwMDgwMDAyMDAwMDAwMDAwMDAwMDAwMDAxMDIwMDAwMDAwMDAwMDAwMDAwMDEwMjAwMDAwMDAwMDAwMDAwMDAwMTAyMDAwMDAwMDAwMDAwMDAwMDAxMDIwMDAwMDAwMDAwMDAwMDAwMDEwMjAwMDAwMDAwMDAwMDAwMDAwMTAyMDAwMDAwMDAwMDAwMDAwMDAxMDIwMDAwMDAwMDAwMDAwMDAwMDEwMjAwMDAwMDIwMDIwMDAwMDAyMDAyMDAwMDAwMjAwMjAwMDAwMDIwMDIwMDAwMDAyMDAyMDAwMDAwMjAwMjAwMDAwMDIwMDIwMDAwMDAyMA==",
|
|
84
|
+
"tileset": [
|
|
85
|
+
"myTiles.transparency16",
|
|
86
|
+
"myTiles.tile1",
|
|
87
|
+
"myTiles.tile2"
|
|
88
|
+
],
|
|
89
|
+
"displayName": "level1"
|
|
90
|
+
},
|
|
91
|
+
"*": {
|
|
92
|
+
"mimeType": "image/x-mkcd-f4",
|
|
93
|
+
"dataEncoding": "base64",
|
|
94
|
+
"namespace": "myTiles"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# tile Kind At
|
|
2
|
+
|
|
3
|
+
Check if the tile next to a sprite is the one you're looking for.
|
|
4
|
+
|
|
5
|
+
```sig
|
|
6
|
+
sprites.create(null).tileKindAt(TileDirection.Right, null)
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
A tile next to a sprite can be matched to a tile you want to check for. You choose the direction to check for to see if the tile is next to the sprite. If the tile matches the one you are looking for in that direction, it will detect it when the sprite is within one-half of it's dimension for that direction.
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
* **direction**: the direction from the sprite for the tile check: `left`, `right`, `top`, or `bottom`.
|
|
14
|
+
* **tile**: an [image](/types/image) that matches the tile you're looking for.
|
|
15
|
+
|
|
16
|
+
## Returns
|
|
17
|
+
|
|
18
|
+
* a [boolean](/types/boolean) value that is `true` if the tile near the sprite at the **direction** matches the **tile** you want to check for. If not, `false` is returned.
|
|
19
|
+
|
|
20
|
+
## Example #example
|
|
21
|
+
|
|
22
|
+
Make a tilemap with three columns of tiles with a different color for each. Set a sprite in motion from left to right. When the sprite comes near a tile, check to see what color the tile is.
|
|
23
|
+
|
|
24
|
+
```blocks
|
|
25
|
+
tiles.setTilemap(tilemap`level1`)
|
|
26
|
+
let mySprite = sprites.create(img`
|
|
27
|
+
. . . . . . . . . . . . . . . .
|
|
28
|
+
. . . . . . . . . . . . . . . .
|
|
29
|
+
. . . . . 1 1 1 1 1 1 . . . . .
|
|
30
|
+
. . . 1 1 9 9 9 9 9 9 1 1 . . .
|
|
31
|
+
. . . 1 9 9 9 9 9 9 9 9 1 . . .
|
|
32
|
+
. . 1 9 9 9 9 9 9 9 9 9 9 1 . .
|
|
33
|
+
. . 1 9 9 9 9 9 9 9 9 9 9 1 . .
|
|
34
|
+
. . 1 9 9 9 9 9 9 9 9 9 9 1 . .
|
|
35
|
+
. . 1 9 9 9 9 9 9 9 9 9 9 1 . .
|
|
36
|
+
. . 1 9 9 9 9 9 9 9 9 9 9 1 . .
|
|
37
|
+
. . 1 9 9 9 9 9 9 9 9 9 9 1 . .
|
|
38
|
+
. . . 1 9 9 9 9 9 9 9 9 1 . . .
|
|
39
|
+
. . . 1 1 9 9 9 9 9 9 1 1 . . .
|
|
40
|
+
. . . . . 1 1 1 1 1 1 . . . . .
|
|
41
|
+
. . . . . . . . . . . . . . . .
|
|
42
|
+
. . . . . . . . . . . . . . . .
|
|
43
|
+
`, SpriteKind.Player)
|
|
44
|
+
mySprite.x = 0
|
|
45
|
+
game.onUpdateInterval(100, function () {
|
|
46
|
+
if (mySprite.tileKindAt(TileDirection.Right, assets.tile`myTile2`)) {
|
|
47
|
+
mySprite.sayText("red", 100, false)
|
|
48
|
+
} else if (mySprite.tileKindAt(TileDirection.Right, assets.tile`myTile1`)) {
|
|
49
|
+
mySprite.sayText("green", 100, false)
|
|
50
|
+
} else if (mySprite.tileKindAt(TileDirection.Right, assets.tile`myTile3`)) {
|
|
51
|
+
mySprite.sayText("yellow", 100, false)
|
|
52
|
+
} else if (mySprite.right >= scene.screenWidth()) {
|
|
53
|
+
mySprite.x = 0
|
|
54
|
+
}
|
|
55
|
+
mySprite.x += 2
|
|
56
|
+
})
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## See also #seealso
|
|
60
|
+
|
|
61
|
+
[is hitting tile](/reference/scene/is-hitting-tile)
|
|
62
|
+
|
|
63
|
+
```jres
|
|
64
|
+
{
|
|
65
|
+
"transparency16": {
|
|
66
|
+
"data": "hwQQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
67
|
+
"mimeType": "image/x-mkcd-f4",
|
|
68
|
+
"tilemapTile": true
|
|
69
|
+
},
|
|
70
|
+
"tile1": {
|
|
71
|
+
"data": "hwQQABAAAADu7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7g==",
|
|
72
|
+
"mimeType": "image/x-mkcd-f4",
|
|
73
|
+
"tilemapTile": true,
|
|
74
|
+
"displayName": "myTile"
|
|
75
|
+
},
|
|
76
|
+
"tile2": {
|
|
77
|
+
"data": "hwQQABAAAACIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiA==",
|
|
78
|
+
"mimeType": "image/x-mkcd-f4",
|
|
79
|
+
"tilemapTile": true,
|
|
80
|
+
"displayName": "myTile0"
|
|
81
|
+
},
|
|
82
|
+
"tile3": {
|
|
83
|
+
"data": "hwQQABAAAAB3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3dw==",
|
|
84
|
+
"mimeType": "image/x-mkcd-f4",
|
|
85
|
+
"tilemapTile": true,
|
|
86
|
+
"displayName": "myTile1"
|
|
87
|
+
},
|
|
88
|
+
"tile4": {
|
|
89
|
+
"data": "hwQQABAAAAAiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIg==",
|
|
90
|
+
"mimeType": "image/x-mkcd-f4",
|
|
91
|
+
"tilemapTile": true,
|
|
92
|
+
"displayName": "myTile2"
|
|
93
|
+
},
|
|
94
|
+
"tile5": {
|
|
95
|
+
"data": "hwQQABAAAABVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVQ==",
|
|
96
|
+
"mimeType": "image/x-mkcd-f4",
|
|
97
|
+
"tilemapTile": true,
|
|
98
|
+
"displayName": "myTile3"
|
|
99
|
+
},
|
|
100
|
+
"level1": {
|
|
101
|
+
"id": "level1",
|
|
102
|
+
"mimeType": "application/mkcd-tilemap",
|
|
103
|
+
"data": "MTAwYTAwMDgwMDAwMDAwMTAwMDAwMzAwMDAwMjAwMDAwMDAxMDAwMDAzMDAwMDAyMDAwMDAwMDEwMDAwMDMwMDAwMDIwMDAwMDAwMTAwMDAwMzAwMDAwMjAwMDAwMDAxMDAwMDAzMDAwMDAyMDAwMDAwMDEwMDAwMDMwMDAwMDIwMDAwMDAwMTAwMDAwMzAwMDAwMjAwMDAwMDAxMDAwMDAzMDAwMDAyMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMA==",
|
|
104
|
+
"tileset": [
|
|
105
|
+
"myTiles.transparency16",
|
|
106
|
+
"myTiles.tile3",
|
|
107
|
+
"myTiles.tile4",
|
|
108
|
+
"myTiles.tile5"
|
|
109
|
+
],
|
|
110
|
+
"displayName": "level1"
|
|
111
|
+
},
|
|
112
|
+
"*": {
|
|
113
|
+
"mimeType": "image/x-mkcd-f4",
|
|
114
|
+
"dataEncoding": "base64",
|
|
115
|
+
"namespace": "myTiles"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
@@ -16,16 +16,18 @@ scene.backgroundImage()
|
|
|
16
16
|
## Tiles and Tilemaps
|
|
17
17
|
|
|
18
18
|
```cards
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
scene.
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
tiles.setTilemap(null)
|
|
20
|
+
tiles.setTileAt(tiles.getTileLocation(0, 0), null)
|
|
21
|
+
tiles.setWallAt(tiles.getTileLocation(0, 0), false)
|
|
22
|
+
tiles.getTileLocation(0, 0)
|
|
23
|
+
tiles.getTilesByType(null)
|
|
24
|
+
tiles.placeOnTile(null, tiles.getTileLocation(0, 0))
|
|
25
|
+
tiles.placeOnRandomTile(null, null)
|
|
26
|
+
scene.onOverlapTile(SpriteKind.Player, null, function (sprite, location) {})
|
|
27
|
+
scene.onHitWall(SpriteKind.Player, function (sprite, location) { })
|
|
28
|
+
tiles.tileAtLocationEquals(tiles.getTileLocation(0, 0), null)
|
|
29
|
+
sprites.create(null).isHittingTile(CollisionDirection.Right)
|
|
30
|
+
sprites.create(null).tileKindAt(TileDirection.Right, null)
|
|
29
31
|
```
|
|
30
32
|
|
|
31
33
|
## Screen Effects
|
|
@@ -51,16 +53,18 @@ scene.cameraShake(4,500)
|
|
|
51
53
|
[set background image](/reference/scene/set-background-image),
|
|
52
54
|
[background color](/reference/scene/background-color),
|
|
53
55
|
[background image](/reference/scene/background-image),
|
|
54
|
-
[set
|
|
55
|
-
[set tile map](/reference/scene/set-tile-map),
|
|
56
|
+
[set tilemap](/reference/scene/set-tilemap),
|
|
56
57
|
[set tile at](/reference/scene/set-tile-at),
|
|
57
|
-
[
|
|
58
|
+
[set wall at](/reference/scene/set-wall-at),
|
|
59
|
+
[get tile location](/reference/scene/get-tile-location),
|
|
58
60
|
[get tiles by type](/reference/scene/get-tiles-by-type),
|
|
59
|
-
[place](/reference/scene/place)
|
|
61
|
+
[place on tile](/reference/scene/place-on-tile,)
|
|
60
62
|
[place on random tile](/reference/scene/place-on-random-tile),
|
|
61
|
-
[on
|
|
63
|
+
[on overlap tile](/reference/scene/on-overlap-tile),
|
|
64
|
+
[on hit wall](/reference/scene/on-hit-wall),
|
|
65
|
+
[tile at location equals](/reference/scene/tile-at-location-equals),
|
|
62
66
|
[is hitting tile](/reference/sprites/sprite-is-hittint-tile),
|
|
63
|
-
[tile
|
|
67
|
+
[tile kind at](/reference/sprites/sprite/tile-kind-at),
|
|
64
68
|
[start screen effect](/reference/scene/start-screen-effect),
|
|
65
69
|
[end screen effect](/reference/scene/end-screen-effect),
|
|
66
70
|
[camera follow sprite](/reference/scene/camera-follow-sprite),
|
package/libs/game/physics.ts
CHANGED
|
@@ -597,7 +597,7 @@ class ArcadePhysicsEngine extends PhysicsEngine {
|
|
|
597
597
|
const alreadyHandled: tiles.Location[] = [];
|
|
598
598
|
|
|
599
599
|
for (const tile of overlappedTiles) {
|
|
600
|
-
if (alreadyHandled.some(l => l.
|
|
600
|
+
if (alreadyHandled.some(l => l.column === tile.column && l.row === tile.row)) {
|
|
601
601
|
continue;
|
|
602
602
|
}
|
|
603
603
|
alreadyHandled.push(tile);
|