Git Product home page Git Product logo

hungry-brain's Introduction

Hungry Brain

Click to Play!

Background

Hungry Brain is a simple single-player math game for kids meant to enhance addition and multitasking skills. Players are instructed to use the left and right keyboard keys to move the mouth object and "eat" numbers falling from the top of the game board. The objective is to catch the number that solves the addition problem featured on the right under Brian the Brain. Every correct number caught renders a new equation, image of Brian, and positively increments the points counter. Every wrong answer negatively decrements Brian's health counter, ending the game as a loss when it reaches 0. Game is won when the player earns 10 points.

Demo GIF

Code Snippet

The game is organized and rendered through a succession of class instances. The entry file starts a new start screen class, where it instanciates a new game class via a click handler event listener. The Game class instantiates the various game pieces, with the main gameplay logic occurring in the play method, as pictured below.

window.requestAnimationFrame() is used to keep the vegetables falling (via the Veg class update method). The cycle stops when the player either earns 10 points, or loses 5 points, instanciating either the game won or lost class.

Technologies Implemented

  • Vanilla JavaScript
  • HTML5 Canvas
  • CSS
  • Webpack/Babel

hungry-brain's People

Contributors

d-tamang 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.