Code Monkey home page Code Monkey logo

2d-game-react-template-app-with-timer's Introduction

2D Game bonded to a timer React Template App

This template let you start developing a game with pre-built common layout and game components & game loop bonded to the customizable timer.

This template app was developed as a "side effect" of my snake game clone project. You can play the game here & see how this template works in practice!

CodeSandbox demo: https://codesandbox.io/s/2d-game-starter-template-with-built-in-timer-t96xxt

Source code on GitHub: https://github.com/vadimgierko/2D-game-react-template-app-with-timer

What's included in this template game app

  • simple pre-built customizable layout & game components:
    • Header
    • Board
    • Speed controllers (increase or decrease timer interval)
    • Touch screen controllers
    • Footer
    • Clock (shows session time)
  • logic mechanism & pattern:
    • timer
    • makeMove() function bonded to a timer, which renders state according to the set interval
    • functions to create board and initState with given rows and columns number
  • basic style:
    • RWD
    • dark mode

Motivation

I've built this template app to reduce my time needed to build other 2D games bonded to the timer in React in the future. When I was developing and refactoring my snake game clone, I've decided to build tetris game clone next, so that was the additional motivation to create this template for quick start.

NOTE / Tutorial

I hope I'll find the time to write a tutorial, how to use this template app to build an example game, but... ... at the moment this template is well commented & generates snake game, so you can figure out, how it works.

The most important built-in functions are:

  • generateEmptyBoard()
  • generateInitBoard() // it completes the empty board with some items
  • generateInitState() // it defines game state:
    • boardSize,
    • board,
    • someItem/s,
    • score,
    • start,
    • pause,
    • end

The main component contains all pre-built functions & UI you need for fast game development:

  • timer,
  • makeMove function bonded to a timer,
  • end game alert.

Follow comments in & don't change too much ;-)

"Logic" folder, reducer & "components" folder is the place, where you can implement unique logic for your game.

Stack

  • React
  • React Icons
  • CSS

2d-game-react-template-app-with-timer's People

Contributors

vadimgierko 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.