Skip to content

Commit

Permalink
chore: Increase number of pipes in Flappy Chicken game
Browse files Browse the repository at this point in the history
The code changes in `playground.jsx` increase the number of pipes generated in the Flappy Chicken game from 7 to 20. This change provides a more challenging gameplay experience for the user.
  • Loading branch information
HasanYahya101 committed Jul 11, 2024
1 parent a9ef279 commit a1fd66c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/components/component/playground.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const FlappyChicken = () => {

const initializePipes = useCallback(() => {
const initialPipes = [];
for (let i = 0; i < 7; i++) {
for (let i = 0; i < 20; i++) {
initialPipes.push(generatePipe(gameSize.width + i * PIPE_SPACING));
}
return initialPipes;
Expand Down Expand Up @@ -120,7 +120,7 @@ const FlappyChicken = () => {
x: pipe.x - PIPE_SPEED,
})).filter((pipe) => pipe.x > -PIPE_WIDTH);

if (newPipes.length < 7) {
if (newPipes.length < 20) {
const lastPipe = newPipes[newPipes.length - 1];
newPipes.push(generatePipe(lastPipe.x + PIPE_SPACING));
}
Expand Down Expand Up @@ -204,13 +204,13 @@ const FlappyChicken = () => {
)}
{gameOver && (
<div className="absolute inset-0 flex flex-col items-center justify-center bg-black bg-opacity-80 text-white">
<div className="text-6xl mb-8 font-bold">
<div className="text-6xl mb-8 font-bold text-center justify-center">
GAME OVER
</div>
<div className="text-4xl mb-4">
<div className="text-4xl mb-4 text-center justify-center">
Score: {score}
</div>
<div className="text-3xl mb-8">
<div className="text-3xl mb-8 text-center justify-center">
Title: {getTitle(score)}
</div>
<Button
Expand Down

0 comments on commit a1fd66c

Please sign in to comment.