Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
<title>Flappy Bird Game</title>
</head>
<body>
<div id="root"></div>
Expand Down
48 changes: 7 additions & 41 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,42 +1,8 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}

.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}

@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
}

.card {
padding: 2em;
}

.read-the-docs {
color: #888;
.app {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
padding: 20px;
}
31 changes: 4 additions & 27 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,11 @@
import { useState } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import FlappyBird from './FlappyBird.jsx'
import './App.css'

function App() {
const [count, setCount] = useState(0)

return (
<>
<div>
<a href="https://vite.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Get Ready To Build Flappy Bird Game!</h1>
<div className="card">
<button onClick={() => setCount((count) => count + 2)}>
count is {count}
</button>
<p>
Edit <code>src/App.jsx</code> and save to test HMR
</p>
</div>
<p className="read-the-docs">
Click on the Vite and React logos to learn more
</p>
</>
<div className="app">
<FlappyBird />
</div>
)
}

Expand Down
158 changes: 158 additions & 0 deletions src/FlappyBird.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
.flappy-bird-container {
max-width: 900px;
margin: 0 auto;
padding: 20px;
text-align: center;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.flappy-bird-container h1 {
color: #2c3e50;
margin-bottom: 20px;
font-size: 2.5rem;
text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.game-area {
position: relative;
display: inline-block;
margin-bottom: 20px;
border-radius: 10px;
box-shadow: 0 8px 32px rgba(0,0,0,0.2);
overflow: hidden;
}

.game-canvas {
display: block;
border: 3px solid #34495e;
border-radius: 10px;
cursor: pointer;
background: linear-gradient(to bottom, #87CEEB 0%, #98FB98 100%);
}

.game-canvas:hover {
box-shadow: 0 0 20px rgba(52, 152, 219, 0.5);
}

.game-info {
position: absolute;
top: 10px;
left: 10px;
right: 10px;
pointer-events: none;
}

.scores {
display: flex;
justify-content: space-between;
color: #2c3e50;
font-weight: bold;
font-size: 18px;
text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
}

.game-message {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: rgba(255,255,255,0.95);
padding: 20px 30px;
border-radius: 15px;
box-shadow: 0 8px 32px rgba(0,0,0,0.3);
border: 2px solid #3498db;
max-width: 300px;
}

.game-message p {
margin: 8px 0;
color: #2c3e50;
font-size: 16px;
font-weight: 500;
}

.game-message.game-over {
border-color: #e74c3c;
background: rgba(255,245,245,0.95);
}

.game-message.game-over p:first-child {
color: #e74c3c;
font-size: 24px;
font-weight: bold;
margin-bottom: 15px;
}

.instructions {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 20px;
border-radius: 10px;
margin-top: 20px;
box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.instructions p {
margin: 10px 0;
font-size: 16px;
font-weight: 500;
}

.instructions p:first-child {
font-size: 18px;
margin-bottom: 15px;
}

/* Responsive design */
@media (max-width: 850px) {
.flappy-bird-container {
padding: 10px;
}

.game-canvas {
width: 100%;
max-width: 800px;
height: auto;
}

.flappy-bird-container h1 {
font-size: 2rem;
}

.scores {
font-size: 14px;
}

.game-message {
max-width: 250px;
padding: 15px 20px;
}

.game-message p {
font-size: 14px;
}

.game-message.game-over p:first-child {
font-size: 20px;
}
}

@media (max-width: 480px) {
.flappy-bird-container h1 {
font-size: 1.5rem;
}

.scores {
flex-direction: column;
gap: 5px;
font-size: 12px;
}

.instructions {
padding: 15px;
}

.instructions p {
font-size: 14px;
}
}
Loading