I believe everyone has played this game... Let me repeat the gameplay.
Gameplay: control the birds in the game. When you press the space, the birds will fly up, or the birds will fall down. During the flight, you cannot encounter yellow obstacles, as well as upper and lower layers. Otherwise, the game ends.
Score: 0 meters
Game Design ideas:
1: birds, it is just flying up and down, and it will not fly around. One setInterval controls the flying birds to keep them flying. The speed increases every time they fly. When the user presses a space, the other setInterval
Execute, control birds to fly up, it is also the speed increase. When the space is released, the birds continue to fly. As the birds fly, they will constantly detect the upper and lower edges.
2: The obstacle is always flying to the left. When the boundary is exceeded, it disappears. During the flight, it will determine whether it hits the birds.
The general principle is as follows. For details, refer to the source code... The design is relatively simple... I hope you can make a brick ..
Complete source code>