55e5125449
* Add game state boolean doc refs * Add check for _img validity * JS guru tricks
1.9 KiB
1.9 KiB
Game
Make games with sprites. Keep score and controls gameplay.
~ hint
Once the game engine is started, it will render the sprites to the screen and potentially override any kind of animation you are trying to show. Using game pause and game resume to disable and enable the game rendering loop.
~
Sprites
game.createSprite(0,0);
game.createSprite(0,0).delete();
game.createSprite(0,0).move(0);
game.createSprite(0,0).turn(Direction.Left,0);
game.createSprite(0,0).ifOnEdgeBounce();
game.createSprite(0,0).get(LedSpriteProperty.X);
game.createSprite(0,0).set(LedSpriteProperty.X, 0);
game.createSprite(0,0).change(LedSpriteProperty.X, 0);
game.createSprite(0,0).isTouching(null);
game.createSprite(0,0).isTouchingEdge();
Scoring
game.addScore(1);
game.score();
game.setScore(0);
Life
game.setLife(0)
game.addLife(0)
game.removeLife(0)
Game control
game.startCountdown(10000);
game.gameOver();
game.pause();
game.resume();
game.isGameOver()
game.isRunning();
game.isPaused();
See also
create sprite, move, turn, ifOnEdgeBounce, get, set, change, is touching is touching edge, add score, score, set score, set life, add life, remove life, start countdown, game over, pause, resume, is game over is running, is paused