![npm](https://camo.githubusercontent.com/112718a99cfab3df067ac6208053a18c51d23b1dbdad1782794213396d28b63a/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f762f776173642d666c617070792e737667)
🐦 Create your own flappy.
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()]
}
]
})
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 |
Flappy#start
Flappy#pause
Flappy#continue
Flappy#gameover
Flappy#restart
game:start
game:ready
game:progress
game:over
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 |
player:hitblock
player:hitfloor
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 |
MIT