-
-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
102 changed files
with
23,111 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>Aim training</title> | ||
<link rel="stylesheet" type="text/css" href="styles.css"> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" /> | ||
</head> | ||
<body> | ||
<div style="text-align: center; | ||
margin-top: 10px; | ||
font-size: 30px; "><i style="color:black;" class="fas fa-home home-icon"></i></a></div> | ||
<h1>Aim training</h1> | ||
<div id="gameContainer"> | ||
<div id="score">Score: <span id="scoreValue">0</span></div> | ||
<div id="highScore">High Score: <span id="highScoreValue">0</span></div> | ||
<div id="timer">Time Left: <span id="timerValue">30</span> seconds</div> | ||
<div id="bubbles"></div> | ||
</div> | ||
<button id="startButton" class="start-button">Start Game</button> | ||
<audio id="popSound" src="pop.wav"></audio> | ||
<audio id="endSound" src="end.wav"></audio> | ||
<script src="script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
// Variables | ||
let score = 0; | ||
let highScore = 0; | ||
let timeLeft = 30; | ||
let timerId; | ||
let level = 1; | ||
let bubbleInterval = 1000; | ||
let gameInProgress = false; // Track if the game is in progress | ||
let bubbleGenerationTimeout; // Store the timeout for bubble generation | ||
|
||
// Function to create a bubble | ||
function createBubble() { | ||
const bubble = document.createElement("div"); | ||
bubble.className = "bubble"; | ||
|
||
// Generate random position | ||
const posX = Math.random() * 500 + 50; | ||
const posY = Math.random() * 300 + 50; | ||
|
||
bubble.style.top = `${posY}px`; | ||
bubble.style.left = `${posX}px`; | ||
|
||
// Generate random size and color | ||
const size = Math.floor(Math.random() * 30) + 20; | ||
const color = `rgb(${Math.random() * 255}, ${Math.random() * 255}, ${Math.random() * 255})`; | ||
|
||
bubble.style.width = `${size}px`; | ||
bubble.style.height = `${size}px`; | ||
bubble.style.backgroundColor = color; | ||
|
||
// Event listener to pop the bubble | ||
bubble.addEventListener("click", function () { | ||
if (bubble.parentNode) { | ||
score++; | ||
document.getElementById("scoreValue").textContent = score; | ||
bubble.parentNode.removeChild(bubble); | ||
playPopSound(); | ||
} | ||
}); | ||
|
||
return bubble; | ||
} | ||
|
||
// Function to start the game | ||
function startGame() { | ||
if (gameInProgress) { | ||
return; // Return if game is already in progress | ||
} | ||
|
||
const bubblesContainer = document.getElementById("bubbles"); | ||
const timerElement = document.getElementById("timerValue"); | ||
const startButton = document.getElementById("startButton"); | ||
|
||
// Clear previous bubbles | ||
while (bubblesContainer.firstChild) { | ||
bubblesContainer.firstChild.remove(); | ||
} | ||
|
||
// Reset game state | ||
score = 0; | ||
timeLeft = 30; | ||
level = 1; | ||
bubbleInterval = 1000; | ||
document.getElementById("scoreValue").textContent = score; | ||
document.getElementById("timerValue").textContent = timeLeft; | ||
gameInProgress = true; | ||
|
||
// Start the timer | ||
timerId = setInterval(function () { | ||
timeLeft--; | ||
timerElement.textContent = timeLeft; | ||
|
||
if (timeLeft === 0) { | ||
clearInterval(timerId); | ||
endGame(); | ||
} | ||
}, 1000); | ||
|
||
// Start generating bubbles | ||
generateBubble(bubblesContainer); | ||
|
||
// Disable start button during gameplay | ||
startButton.disabled = true; | ||
} | ||
|
||
// Function to generate bubbles | ||
function generateBubble(container) { | ||
if (!gameInProgress) { | ||
return; // Return if game is not in progress | ||
} | ||
|
||
const bubble = createBubble(); | ||
container.appendChild(bubble); | ||
|
||
// Schedule next bubble generation | ||
bubbleGenerationTimeout = setTimeout(function () { | ||
generateBubble(container); | ||
}, bubbleInterval); | ||
} | ||
|
||
// Function to end the game | ||
function endGame() { | ||
gameInProgress = false; // Set gameInProgress to false | ||
|
||
// Clear bubble generation timeout | ||
clearTimeout(bubbleGenerationTimeout); | ||
|
||
const startButton = document.getElementById("startButton"); | ||
startButton.disabled = false; | ||
playEndSound(); | ||
|
||
// Update high score | ||
if (score > highScore) { | ||
highScore = score; | ||
document.getElementById("highScoreValue").textContent = highScore; | ||
} | ||
|
||
// Display game over message | ||
setTimeout(function () { | ||
alert("Game Over! Your score: " + score); | ||
}, 100); | ||
} | ||
|
||
// Function to play bubble pop sound | ||
function playPopSound() { | ||
const popSound = document.getElementById("popSound"); | ||
popSound.currentTime = 0; | ||
popSound.play(); | ||
} | ||
|
||
// Function to play game end sound | ||
function playEndSound() { | ||
const endSound = document.getElementById("endSound"); | ||
endSound.currentTime = 0; | ||
endSound.play(); | ||
} | ||
|
||
// Event listener for start button | ||
document.getElementById("startButton").addEventListener("click", startGame); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
body { | ||
text-align: center; | ||
} | ||
|
||
h1 { | ||
color: #333; | ||
} | ||
|
||
#gameContainer { | ||
margin-top: 50px; | ||
position: relative; | ||
} | ||
|
||
#score, | ||
#highScore, | ||
#timer { | ||
font-size: 20px; | ||
color: #333; | ||
margin-bottom: 10px; | ||
} | ||
|
||
#bubbles { | ||
position: relative; | ||
width: 600px; | ||
height: 400px; | ||
margin: 0 auto; | ||
background-color: #ccc; | ||
border: 2px solid #333; | ||
border-radius: 10px; | ||
overflow: hidden; | ||
} | ||
|
||
.bubble { | ||
position: absolute; | ||
width: 50px; | ||
height: 50px; | ||
border-radius: 50%; | ||
background-color: #f00; | ||
cursor: pointer; | ||
transition: top 0.5s ease-in-out, left 0.5s ease-in-out; | ||
} | ||
|
||
.bubble:hover { | ||
background-color: #f00; | ||
transform: scale(1.2); | ||
} | ||
|
||
#scoreValue, | ||
#highScoreValue { | ||
font-weight: bold; | ||
} | ||
|
||
#timerValue { | ||
font-weight: bold; | ||
animation: blink 1s infinite; | ||
} | ||
|
||
.start-button { | ||
padding: 10px 20px; | ||
font-size: 16px; | ||
background-color: #333; | ||
color: #fff; | ||
border: none; | ||
cursor: pointer; | ||
margin-top: 20px; | ||
} | ||
|
||
@keyframes countdown { | ||
0% { | ||
transform: scale(1); | ||
} | ||
50% { | ||
transform: scale(1.1); | ||
} | ||
100% { | ||
transform: scale(1); | ||
} | ||
} | ||
|
||
@media (max-width: 768px) { | ||
#bubbles { | ||
width: 80%; | ||
height: 300px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<style> | ||
body { | ||
font-family: Arial, sans-serif; | ||
background-color: #f4f4f4; | ||
margin: 0; | ||
padding: 0; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
} | ||
|
||
.container { | ||
text-align: center; | ||
background-color: #fff; | ||
border: 1px solid #ccc; | ||
border-radius: 5px; | ||
padding: 20px; | ||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
h1 { | ||
margin-bottom: 20px; | ||
} | ||
|
||
#userCards { | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: center; | ||
} | ||
|
||
.userCard { | ||
border: 1px solid #ccc; | ||
border-radius: 5px; | ||
padding: 20px; | ||
margin: 10px; | ||
width: 200px; | ||
text-align: center; | ||
} | ||
|
||
.userAvatar { | ||
border-radius: 50%; | ||
width: 80px; | ||
height: 80px; | ||
margin-bottom: 10px; | ||
} | ||
</style> | ||
<title>Random User Cards</title> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1>Random User Cards</h1> | ||
<div id="userCards"></div> | ||
</div> | ||
|
||
<script> | ||
document.addEventListener('DOMContentLoaded', function () { | ||
const userCardsContainer = document.getElementById('userCards'); | ||
|
||
// Function to generate random user cards | ||
function generateUserCards(numCards) { | ||
for (let i = 0; i < numCards; i++) { | ||
// Fetch random user data from the API | ||
fetch('https://randomuser.me/api/') | ||
.then(response => response.json()) | ||
.then(data => { | ||
const user = data.results[0]; | ||
const name = `${user.name.first} ${user.name.last}`; | ||
const experience = `Experience: ${user.dob.age - 20}`; | ||
const city = user.location.city; | ||
const avatar = user.picture.medium; | ||
|
||
// Create a user card element and populate it with user data | ||
const userCard = document.createElement('div'); | ||
userCard.classList.add('userCard'); | ||
userCard.innerHTML = ` | ||
<img src="${avatar}" alt="User Avatar" class="userAvatar"> | ||
<h2>${name}</h2> | ||
<p>${experience}</p> | ||
<p>${city}</p> | ||
`; | ||
|
||
userCardsContainer.appendChild(userCard); | ||
}) | ||
.catch(error => console.error('Error fetching random user:', error)); | ||
} | ||
} | ||
|
||
// Generate a specified number of user cards (e.g., 10) | ||
generateUserCards(10); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# pythonw runs program in background - pythonw notification.py | ||
|
||
from plyer import notification | ||
import time | ||
|
||
if __name__ == '__main__': | ||
while True: | ||
notification.notify( | ||
title = " *** Drink Water *** ", | ||
message= "Getting enough water every day is important for your health. Drinking water can prevent dehydration, a condition that can cause unclear thinking, result in mood change, cause your body to overheat, and lead to constipation and kidney stones.", | ||
# app_icon= "C:\Users\BHATTAD\OneDrive\Desktop\python projects\Desktop Notification\water.ico", | ||
timeout = 5) | ||
time.sleep(3600) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
## Desktop Notification in Python |
Binary file not shown.
Oops, something went wrong.