🐦 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