Skip to content
This repository has been archived by the owner on Nov 8, 2019. It is now read-only.

Commit

Permalink
simplify more
Browse files Browse the repository at this point in the history
  • Loading branch information
tballmsft committed Sep 25, 2019
1 parent 7dc6b30 commit 060a256
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
21 changes: 7 additions & 14 deletions blockstile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,14 @@ namespace TileWorld {
* @param index
* @param img
*/
//% blockId=TWsettile block="set %index=colorindexpicker to fixed sprite %img=tile_image_picker with $kind=spritekind""
//% blockId=TWaddsprite block="set $code=colorindexpicker to $kk sprite $image=tile_image_picker with $kind=spritekind"
//% group="Tiles"
export function setTile(code: number, image: Image, kind: number) {
myWorld.addTiles(code, image)
}

/**
* Set an image as a sprite at the given index. Sprites should be a 16x16 image
* @param index
* @param img
*/
//% blockId=TWsetsprite block="set %index=colorindexpicker to movable sprite %img=tile_image_picker with $kind=spritekind"
//% group="Tiles"
export function addTileSprite(code: number, image: Image, kind: number) {
myWorld.addTileSprites(code, image, kind)
//% inlineInputMode=inline
export function addSprite(code: number, image: Image, kk: KindKind, kind: number) {
if (kk == KindKind.Fixed)
myWorld.addTiles(code, image)
else
myWorld.addTileSprites(code, image, kind)
}

/**
Expand Down
7 changes: 7 additions & 0 deletions tileworld.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ enum Testing {
NotOneOf
}

enum KindKind {
//% block="fixed"
Fixed,
//% block="movable"
Movable
}

//%
namespace TileWorld {

Expand Down

0 comments on commit 060a256

Please sign in to comment.