GithubHelp home page GithubHelp logo

guananddu / arduino_tetris Goto Github PK

View Code? Open in Web Editor NEW

This project forked from adamgreig/arduino_tetris

0.0 1.0 0.0 116 KB

Play Tetris on an Arduino, using a 128x96 colour LCD and four buttons

Makefile 48.45% C 51.55%

arduino_tetris's Introduction

Arduino Tetris

Hardware

Method

A 10x20 char grid represents the game grid. A struct that holds four two-byte Positions represents the piece in play. The code then loops through, deciding whether to apply gravity each loop based on how long it was since gravity was previously applied, then checking for a collision if so. If a collision happened the current piece is saved to the grid and a new one is generated. The grid is checked for newly completed lines and if any are found they're cleared and the player gets a point. In the meantime, the four buttons are on the pin change interrupt, and drive the move_left, move_right, rotate and drop functions. Interrupts are disabled each time one happens and reenabled after drawing each frame to help stop accidental repeats. At the end of the game, when a block is placed in the top row, the grid is filled with red and then a number of squares are lit up green to represent the player's score. This is problematic with a score of over 200, but that's a pretty unlikely edge case.

arduino_tetris's People

Contributors

adamgreig avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.