Giter Club home page Giter Club logo

wasd-flappy's Introduction

wasd-flappy

Build Status Coverage Status npm

๐Ÿฆ Create your own flappy.

Installation

npm i wasd-flappy -S

Demo

Usage

import Flappy, { Player, Block } from 'wasd-flappy'

new Flappy({
  canvas: {
    width: 300,
    height: 400
  },
  player: new Player({
    height: 30,
    width: 30
  }),
  levels: [
    {
      score: 0,
      blocks: [new Block()]
    }
  ]
})

API

Flappy

Options

Name Description Type Accepted Values Default
canvas.width Canvas width Number - 300
canvas.height Canvas height Number - 600
canvas.floorHeight floor height Number - 0
canvas.fps fps Number - 30
player player Player - -
levels[].score score Number - -
levels[].blocks blocks Block[] - -
levels[].blockDistance block distance Number Array -
levels[].blockRandom block random Boolean - false

Methods

  • Flappy#start
  • Flappy#pause
  • Flappy#continue
  • Flappy#gameover
  • Flappy#restart

Events

  • game:start
  • game:ready
  • game:progress
  • game:over

Properties

Player

Options

Name Description Type Accepted Values Default
width Player width Number - 30
height Player height Number - 30
startX start x Number - 0
startY start y Number - 0
velocity velocity Number - 15
g gravitational Number - 20
name name String - 'Player'
pop Fault tolerance Number - 0
reverse reverse Boolean - false
meta anything * - null

Methods

  • Player#jump

Events

  • player:hitblock
  • player:hitfloor

Properties

Block

Options

Name Description Type Accepted Values Default
width Block width Number Array -
height Block height Number Array -
padding padding Number Array -
placement placement String 'random', 'bottom', 'top' 30
name name String - 'Block'
meta anything * - null

Properties

License

MIT

wasd-flappy's People

Contributors

qingwei-li avatar

Stargazers

Ben avatar kgaikj avatar ๆŽๆ—ญ avatar  avatar  avatar Galen avatar lubo avatar lenrinfvck avatar ้™ˆๅฎ‡ avatar

Watchers

James Cloos avatar  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.