ProPerNounpYK commited on
Commit
fd9249a
·
verified ·
1 Parent(s): 0beab7f

Update index.html

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