This extension contains advanced APIs for working with tilemaps in blocks.
The ||tiles.createSpritesOnTiles||
block creates an empty sprite on top of each location with the specified tile. Combine this with ||sprites.onCreated||
to initialize the empty sprites with an image, position, etc.
tileKind
is the image of the tile where sprites will be createdspriteKind
is the kind of sprite that will be createdCreate a small green box on each empty tile.
sprites.onCreated(SpriteKind.Enemy, function (sprite) {
sprite.setImage(img`
7 7
7 7
`)
})
tiles.setTilemap(tiles.createTilemap(hex`0400040000000000000000000000000000000000`, img`
. . . .
. . . .
. . . .
. . . .
`, [myTiles.transparency16], TileScale.Sixteen))
tiles.createSpritesOnTiles(myTiles.transparency16, SpriteKind.Enemy)
This repository can be added as an extension in Microsoft MakeCode.
To edit this repository in Microsoft MakeCode.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.