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

Commit

Permalink
fix up move api
Browse files Browse the repository at this point in the history
  • Loading branch information
tballmsft committed Sep 24, 2019
1 parent 3b2b846 commit 377c486
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions blockstile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,18 @@ namespace TileWorld {
myWorld.addTileSprites(code, image, kind)
}
/**
* Set the player
* Move sprite with buttons
* @param color
*/
//% group="Tiles"
//% blockId=TWsetplayer block="set player to %color=colorindexpicker"
export function setPlayer(code: number) {
let player = myWorld.getSprite(code)
bindToController(player)
scene.cameraFollowSprite(player)
//% blockId=TWmoveButtons block="move $kind=spritekind with buttons"
export function moveWithButtons(kind: number) {
let sprites = game.currentScene().spritesByKind[kind].sprites()
sprites.forEach((s) => {
if (s instanceof TileSprite) {
bindToController(<TileSprite>s)}
}
)
}

// notifications
Expand Down

0 comments on commit 377c486

Please sign in to comment.