Skip to content

Tetris game implementation using moonlander's RGB lighting and QMK firmware.

License

Notifications You must be signed in to change notification settings

lll-phill-lll/tetris_keyboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Keyboard tetris game

Description

General image

This is a fun project I developed while testing QMK library with ZSA moonlander.

I was trying to implement custom layout and stumbled upon the article describing custom RGB-lighting and couldn't get past it.

Thumb clusters are used next figure indication and falling figures control. Field size is 10x7 excepting 6 missing keys (pixels). While clearing the rows these missing keys are taken into account. So, you need to fill only 5 cells of the last row in order to clear the line.

Gameplay

Video

Shorts with Tetris sounds

Fancy without Tetris sounds

Gif

Full gameplay

Implemented features

  1. Spawn all 7 pieces: I, O, Z, S, J, L, T.
  2. Rotate and move all pieces.
  3. Clear the row if it's covered.
  4. Indicate next piece with color.
  5. Music theme (I bet it will be deleted).
  6. Fair random algorithm.
  7. Gameover animation and sound.

Not implemented features

  1. Fancy SRS rotation.
  2. Score counter.
  3. Fast move down.

Controls

  1. All the game is controlled using the thumb cluster of the right half of the keyboard.
  2. There are also: toggle music button, pause button, restart button, start button.

How to install

  1. Install QMK using the tutorial from here.
  2. Clone this repo.
  3. Copy all the content to <YOU_QMK_FOLDER>/keyboards/moonlander/keymaps/<YOUR_NAME> or make a symlink.
  4. Put your keyboard into bootloader mode. (Click a small button in a hole on a left half of moonlander)
  5. Flash the keyboard using this tutorial.

Useful links

  1. Implementing custom colorscheme.
  2. Implementing custom sounds.

Process

Here you can see my tables.

Tables

Colors

Top left table is initial colors to keys mapping. Next tables are my remaps (don't ask why such an order). Red keys are non-existing ones. These rows has less cells and we need to take it into account while calculating the collisions.

Rotations

I used the simpliest possible rotation system. All the pieces are rotated around 3 cell. Kicks are not implemented. The only thing I check here is collisions with walls and other pieces.

Code quality

Sorry :(

Gifs

Game over

Game over

Rotate

Rotate

Acknowledgement

I found this repo somewhere on reddit: and it was superuseful and helped me a lot to understand QMK library. Shutout to @rgoulter.

And additional thanks to @optozorax for the motivation to this project.

About

Tetris game implementation using moonlander's RGB lighting and QMK firmware.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published