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

@ -240,6 +240,8 @@
"serial.delimiters": "Returns the delimiter corresponding string", "serial.delimiters": "Returns the delimiter corresponding string",
"serial.onDataReceived": "Registers an event to be fired when one of the delimiter is matched.", "serial.onDataReceived": "Registers an event to be fired when one of the delimiter is matched.",
"serial.onDataReceived|param|delimiters": "the characters to match received characters against.", "serial.onDataReceived|param|delimiters": "the characters to match received characters against.",
"serial.readBuffer": "Reads multiple characters from the rxBuff and fills a user buffer.",
"serial.readBuffer|param|length": "default buffer length, eg: 64",
"serial.readLine": "Reads a line of text from the serial port.", "serial.readLine": "Reads a line of text from the serial port.",
"serial.readString": "Reads the buffered received data as a string", "serial.readString": "Reads the buffered received data as a string",
"serial.readUntil": "Reads a line of text from the serial port and returns the buffer when the delimiter is met.", "serial.readUntil": "Reads a line of text from the serial port and returns the buffer when the delimiter is met.",
@ -248,6 +250,7 @@
"serial.redirect|param|rate": "the new baud rate. eg: 115200", "serial.redirect|param|rate": "the new baud rate. eg: 115200",
"serial.redirect|param|rx": "the new reception pin, eg: SerialPin.P1", "serial.redirect|param|rx": "the new reception pin, eg: SerialPin.P1",
"serial.redirect|param|tx": "the new transmission pins, eg: SerialPin.P0", "serial.redirect|param|tx": "the new transmission pins, eg: SerialPin.P0",
"serial.writeBuffer": "Sends a buffer through Serial connection",
"serial.writeLine": "Prints a line of text to the serial", "serial.writeLine": "Prints a line of text to the serial",
"serial.writeNumber": "Prints a numeric value to the serial", "serial.writeNumber": "Prints a numeric value to the serial",
"serial.writeString": "Sends a piece of text through Serial connection.", "serial.writeString": "Sends a piece of text through Serial connection.",

View File

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