Spaces:
Running
Running
Update index.html
Browse files- index.html +170 -164
index.html
CHANGED
|
@@ -1,171 +1,177 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html>
|
| 3 |
<head>
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
</head>
|
| 91 |
<body>
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
</body>
|
| 171 |
</html>
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html>
|
| 3 |
<head>
|
| 4 |
+
<style>
|
| 5 |
+
body {
|
| 6 |
+
margin: 0;
|
| 7 |
+
overflow: hidden;
|
| 8 |
+
background: #1a1a1a;
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
canvas {
|
| 12 |
+
cursor: pointer;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
#gameCanvas {
|
| 16 |
+
background-image: url('stage 1.jpg');
|
| 17 |
+
background-size: cover;
|
| 18 |
+
display: none;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
#message {
|
| 22 |
+
position: fixed;
|
| 23 |
+
bottom: 550px;
|
| 24 |
+
left: 0;
|
| 25 |
+
width: 100%;
|
| 26 |
+
color: white;
|
| 27 |
+
text-align: center;
|
| 28 |
+
font-size: 30px;
|
| 29 |
+
font-family: Arial;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
#stats {
|
| 33 |
+
position: fixed;
|
| 34 |
+
top: 20px;
|
| 35 |
+
left: 20px;
|
| 36 |
+
color: white;
|
| 37 |
+
font-family: Arial;
|
| 38 |
+
font-size: 28px;
|
| 39 |
+
display: none;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
#villainCount {
|
| 43 |
+
position: fixed;
|
| 44 |
+
top: 20px;
|
| 45 |
+
right: 20px;
|
| 46 |
+
color: white;
|
| 47 |
+
font-family: Arial;
|
| 48 |
+
font-size: 28px;
|
| 49 |
+
display: none;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
#healthBar {
|
| 53 |
+
width: 300px;
|
| 54 |
+
height: 30px;
|
| 55 |
+
background: #333;
|
| 56 |
+
margin-top: 5px;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
#healthFill {
|
| 60 |
+
width: 100%;
|
| 61 |
+
height: 100%;
|
| 62 |
+
background: red;
|
| 63 |
+
transition: width 0.3s;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
#bulletCount, #enemyCount {
|
| 67 |
+
font-size: 28px;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
#replayButton {
|
| 71 |
+
position: fixed;
|
| 72 |
+
top: 50%;
|
| 73 |
+
left: 50%;
|
| 74 |
+
transform: translate(-50%, -50%);
|
| 75 |
+
padding: 15px 30px;
|
| 76 |
+
font-size: 20px;
|
| 77 |
+
font-family: Arial;
|
| 78 |
+
background-color: white;
|
| 79 |
+
color: black;
|
| 80 |
+
border: none;
|
| 81 |
+
border-radius: 5px;
|
| 82 |
+
display: none;
|
| 83 |
+
cursor: pointer;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
#replayButton:hover {
|
| 87 |
+
background-color: lightgray;
|
| 88 |
+
}
|
| 89 |
+
</style>
|
| 90 |
</head>
|
| 91 |
<body>
|
| 92 |
+
<canvas id="introCanvas"></canvas>
|
| 93 |
+
<canvas id="gameCanvas"></canvas>
|
| 94 |
+
<div id="message"></div>
|
| 95 |
+
<div id="stats">
|
| 96 |
+
Health:<div id="healthBar"><div id="healthFill"></div></div>
|
| 97 |
+
Bullets: <span id="bulletCount">35</span>
|
| 98 |
+
</div>
|
| 99 |
+
<div id="villainCount">Villains: <span id="enemyCount">30</span></div>
|
| 100 |
+
<button id="replayButton">Replay</button>
|
| 101 |
+
|
| 102 |
+
<audio id="bgMusic" src="cinematic-time-lapse-115672.mp3" loop></audio>
|
| 103 |
+
<audio id="playerShootSound" src="Maincharactergunsound.mp3"></audio>
|
| 104 |
+
<audio id="enemyShootSound" src="Renovatorsgunshot.mp3"></audio>
|
| 105 |
+
<audio id="playerHitSound" src="Maincharactershot.mp3"></audio>
|
| 106 |
+
<audio id="enemyHitSound" src="Renovatorsgetshot.mp3"></audio>
|
| 107 |
+
|
| 108 |
+
<script>
|
| 109 |
+
// Intro Animation Code
|
| 110 |
+
const introCanvas = document.getElementById('introCanvas');
|
| 111 |
+
const gameCanvas = document.getElementById('gameCanvas');
|
| 112 |
+
const introCtx = introCanvas.getContext('2d');
|
| 113 |
+
|
| 114 |
+
let particles = [];
|
| 115 |
+
const phrases = [
|
| 116 |
+
{ text: 'Hello everyone.', size: 65, duration: 5000 },
|
| 117 |
+
{ text: 'You have been selected as the next\nTimewalker for our team of Space Guardians.', size: 50, duration: 7000 },
|
| 118 |
+
{ text: 'Repair the collapsing timelines\nand return safely.', size: 55, duration: 6000 },
|
| 119 |
+
{ text: 'Good luck.\n- From the Space Guardians Leader', sizes: [65, 45], spacing: 45, duration: 6000 },
|
| 120 |
+
{ text: 'TimeWalker', size: 65, duration: 3000 },
|
| 121 |
+
{ text: 'Chapter 1', size: 65, duration: null }
|
| 122 |
+
];
|
| 123 |
+
|
| 124 |
+
let currentPhraseIndex = 0;
|
| 125 |
+
let introAnimationFrame;
|
| 126 |
+
let mouseX = 0;
|
| 127 |
+
let mouseY = 0;
|
| 128 |
+
|
| 129 |
+
introCanvas.width = window.innerWidth;
|
| 130 |
+
introCanvas.height = window.innerHeight;
|
| 131 |
+
|
| 132 |
+
// ... [Your existing intro animation code - Particle class, createParticles, transition, animate functions etc]
|
| 133 |
+
|
| 134 |
+
// Modify the transition function to start game after last phrase
|
| 135 |
+
function transition() {
|
| 136 |
+
if(currentPhraseIndex < phrases.length - 1) {
|
| 137 |
+
currentPhraseIndex++;
|
| 138 |
+
const currentPhrase = phrases[currentPhraseIndex];
|
| 139 |
+
|
| 140 |
+
// ... [Rest of your transition code]
|
| 141 |
+
|
| 142 |
+
if(currentPhrase.duration) {
|
| 143 |
+
setTimeout(transition, currentPhrase.duration);
|
| 144 |
+
}
|
| 145 |
+
} else {
|
| 146 |
+
// When intro ends, start the game
|
| 147 |
+
setTimeout(() => {
|
| 148 |
+
introCanvas.style.display = 'none';
|
| 149 |
+
gameCanvas.style.display = 'block';
|
| 150 |
+
document.getElementById('stats').style.display = 'block';
|
| 151 |
+
document.getElementById('villainCount').style.display = 'block';
|
| 152 |
+
startGame();
|
| 153 |
+
}, 2000);
|
| 154 |
+
}
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
// Start intro animation
|
| 158 |
+
particles = createParticles(phrases[0]);
|
| 159 |
+
animate();
|
| 160 |
+
setTimeout(transition, phrases[0].duration);
|
| 161 |
+
|
| 162 |
+
// Game Code
|
| 163 |
+
function startGame() {
|
| 164 |
+
// ... [All your game code here]
|
| 165 |
+
|
| 166 |
+
const ctx = gameCanvas.getContext('2d');
|
| 167 |
+
gameCanvas.width = window.innerWidth;
|
| 168 |
+
gameCanvas.height = window.innerHeight;
|
| 169 |
+
|
| 170 |
+
// ... [Rest of your game initialization and logic]
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
// Play intro audio
|
| 174 |
+
playAudioForDuration('reflected-light-147979.mp3', 31000);
|
| 175 |
+
</script>
|
| 176 |
</body>
|
| 177 |
</html>
|