Add isDeleted (#2445)

This commit is contained in:
Franklin Tse
2019-09-25 20:47:25 +08:00
committed by Peli de Halleux
parent a10a69b96c
commit 19dffde1a8
4 changed files with 45 additions and 1 deletions

View File

@ -281,6 +281,7 @@
"game.LedSprite.goTo|param|x": "TODO",
"game.LedSprite.goTo|param|y": "TODO",
"game.LedSprite.ifOnEdgeBounce": "If touching the edge of the stage and facing towards it, then turn away.",
"game.LedSprite.isDeleted": "Reports whether the sprite has been deleted from the game engine.",
"game.LedSprite.isTouching": "Reports true if sprite has the same position as specified sprite",
"game.LedSprite.isTouchingEdge": "Reports true if sprite is touching an edge",
"game.LedSprite.isTouching|param|other": "the other sprite to check overlap or touch",

View File

@ -266,6 +266,7 @@
"game.LedSprite.delete|block": "delete %this(sprite)",
"game.LedSprite.get|block": "%sprite|%property",
"game.LedSprite.ifOnEdgeBounce|block": "%sprite|if on edge, bounce",
"game.LedSprite.isDeleted|block": "is %sprite|deleted",
"game.LedSprite.isTouchingEdge|block": "is %sprite|touching edge",
"game.LedSprite.isTouching|block": "is %sprite|touching %other",
"game.LedSprite.move|block": "%sprite|move by %leds",

View File

@ -695,7 +695,7 @@ namespace game {
* Deletes the sprite from the game engine. The sprite will no longer appear on the screen or interact with other sprites.
* @param this sprite to delete
*/
//% weight=59 help=game/delete
//% weight=59 blockGap=8 help=game/delete
//% blockId="game_delete_sprite" block="delete %this(sprite)"
public delete(): void {
this._enabled = false;
@ -703,6 +703,15 @@ namespace game {
plot();
}
/**
* Reports whether the sprite has been deleted from the game engine.
*/
//% weight=58 help=game/is-deleted
//% blockId="game_sprite_is_deleted" block="is %sprite|deleted"
public isDeleted(): boolean {
return !this._enabled;
}
/**
* Sets the blink duration interval in millisecond.
* @param sprite TODO