Gamefixes (#389)

* call plot after deleting sprite

* fix double registration
This commit is contained in:
Peli de Halleux
2017-04-21 10:40:31 -07:00
committed by GitHub
parent ef1b51e7da
commit 1e4014dc03
2 changed files with 6 additions and 4 deletions

View File

@ -46,8 +46,6 @@ namespace game {
export function createSprite(x: number, y: number): LedSprite {
init();
let p = new LedSprite(x, y);
sprites.push(p);
plot();
return p;
}
@ -648,9 +646,10 @@ namespace game {
* @param this sprite to delete
*/
//% weight=59
//% blockId="game_delete_sprite" block="delete %this"
//% blockId="game_delete_sprite" block="delete %this"
public delete(): void {
sprites.removeElement(this);
if (sprites.removeElement(this))
plot();
}
/**