Another tetromino falling block game implementation.
Remember the hidden tetromino game in Emacs using the M-x tetris
command? I
just wanted the same kind of useful tool with VSCode.
Open the game using the command palette Ctrl+Shift+P
(or Cmd+Shift+P
on
MacOS), then type Tetromino
.
The current commands to play the game are:
left
: move block to leftright
: move block to rightbottom
: accelerate drop of block, press again to stop the fallup
: rotate block to rightspace
: rotate block to rightx
: rotate block to leftp
: pause
This game was originally created for Atom.
According to my understanding, displaying other things than source code text in VSCode is quite difficult. To achieve that, the simplest way is to use a WebView. There are two ways two do that:
- frequently update HTML code, with the business logic code controlled and executed by VSCode
- embed a full HTML web page with business logic code, with a flag telling this web page can directly execute JavaScript code
The first option was chosen because it was more similar to the original Tetromino code that was originally developped for Atom. Moreover, this option seems more "safe" to me: the stability of VSCode should be guaranteed, and there should be no possible security issues with the extension.
This choice brings some constraints: the extension can only catch keyboard key values, but cannot catch a pushdown or pushup key event, which could have been interesting when making a tetromino piece fall down.
Contributions and bug reports are welcome. Please keep in mind that the whole idea of the project is to have a minimalist implementation of the tetromino falling block game, so the game must not evolve too much. It is only for fun, like the Emacs tetromino game.
The game uses the following third party library with their own licenses. Please
check the file LICENSE-3RD-PARTY.md
for the full license descriptions.
Name | License Type | Author |
---|---|---|
Hashids | MIT | Ivan Akimov |