Spaces:
Sleeping
Sleeping
loic.ledreck
commited on
Commit
·
8720f76
1
Parent(s):
b7a57b8
feat: display the rules
Browse files- static/intro.html +29 -12
static/intro.html
CHANGED
@@ -54,7 +54,7 @@
|
|
54 |
|
55 |
@keyframes flameAnim {
|
56 |
100% {
|
57 |
-
background-position: -1000px 0;
|
58 |
}
|
59 |
}
|
60 |
</style>
|
@@ -65,7 +65,7 @@
|
|
65 |
<div id="flames"></div>
|
66 |
|
67 |
<script>
|
68 |
-
const
|
69 |
"Warning !",
|
70 |
"This game is a work of fiction.",
|
71 |
"Any resemblance to real people or events is purely coincidental.",
|
@@ -75,9 +75,6 @@
|
|
75 |
"People are eating cats and dogs.",
|
76 |
"Oil production? It's practically a fairy tale now ! ",
|
77 |
"God sent the perfect president to save the nation.",
|
78 |
-
"",
|
79 |
-
"Welcome to",
|
80 |
-
"What Could Possibly Go Wrong in 2025 !"
|
81 |
];
|
82 |
|
83 |
const textContainer = document.getElementById('text-container');
|
@@ -86,7 +83,7 @@
|
|
86 |
let charIndex = 0; // Indice du caractère en cours dans la ligne
|
87 |
let currentLineElem; // Élement HTML pour la ligne en cours (si non vide)
|
88 |
|
89 |
-
function typeWriter() {
|
90 |
// Si on a traité toutes les lignes, on arrête
|
91 |
if (lineIndex >= lines.length) {
|
92 |
return;
|
@@ -109,12 +106,12 @@
|
|
109 |
|
110 |
lineIndex++;
|
111 |
charIndex = 0;
|
112 |
-
typeWriter(); // relance l'affichage de la ligne suivante
|
113 |
|
114 |
// On quitte immédiatement la fonction pour éviter tout conflit de setTimeout
|
115 |
return;
|
116 |
}
|
117 |
-
|
118 |
// -- 2) Si la ligne n'est pas vide, affichage "lettre par lettre" --
|
119 |
if (charIndex === 0) {
|
120 |
// On crée un nouvel élément pour la nouvelle ligne
|
@@ -128,7 +125,7 @@
|
|
128 |
|
129 |
// S'il reste des caractères à afficher dans la ligne
|
130 |
if (charIndex < currentLine.length) {
|
131 |
-
setTimeout(typeWriter, 30);
|
132 |
} else {
|
133 |
// Ligne terminée : on passe à la ligne suivante
|
134 |
lineIndex++;
|
@@ -136,14 +133,34 @@
|
|
136 |
currentLineElem = null;
|
137 |
|
138 |
// Petite pause avant d'attaquer la prochaine ligne
|
139 |
-
setTimeout(typeWriter, 25);
|
140 |
}
|
141 |
}
|
142 |
|
143 |
// On démarre le « typewriter »
|
144 |
-
typeWriter()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
</script>
|
146 |
</body>
|
147 |
|
148 |
|
149 |
-
</html>
|
|
|
54 |
|
55 |
@keyframes flameAnim {
|
56 |
100% {
|
57 |
+
background-position: -1000px 0;
|
58 |
}
|
59 |
}
|
60 |
</style>
|
|
|
65 |
<div id="flames"></div>
|
66 |
|
67 |
<script>
|
68 |
+
const lines1 = [
|
69 |
"Warning !",
|
70 |
"This game is a work of fiction.",
|
71 |
"Any resemblance to real people or events is purely coincidental.",
|
|
|
75 |
"People are eating cats and dogs.",
|
76 |
"Oil production? It's practically a fairy tale now ! ",
|
77 |
"God sent the perfect president to save the nation.",
|
|
|
|
|
|
|
78 |
];
|
79 |
|
80 |
const textContainer = document.getElementById('text-container');
|
|
|
83 |
let charIndex = 0; // Indice du caractère en cours dans la ligne
|
84 |
let currentLineElem; // Élement HTML pour la ligne en cours (si non vide)
|
85 |
|
86 |
+
function typeWriter(lines, lineIndex, charIndex) {
|
87 |
// Si on a traité toutes les lignes, on arrête
|
88 |
if (lineIndex >= lines.length) {
|
89 |
return;
|
|
|
106 |
|
107 |
lineIndex++;
|
108 |
charIndex = 0;
|
109 |
+
typeWriter(lines, lineIndex, charIndex); // relance l'affichage de la ligne suivante
|
110 |
|
111 |
// On quitte immédiatement la fonction pour éviter tout conflit de setTimeout
|
112 |
return;
|
113 |
}
|
114 |
+
|
115 |
// -- 2) Si la ligne n'est pas vide, affichage "lettre par lettre" --
|
116 |
if (charIndex === 0) {
|
117 |
// On crée un nouvel élément pour la nouvelle ligne
|
|
|
125 |
|
126 |
// S'il reste des caractères à afficher dans la ligne
|
127 |
if (charIndex < currentLine.length) {
|
128 |
+
setTimeout(() => typeWriter(lines, lineIndex, charIndex), 30);
|
129 |
} else {
|
130 |
// Ligne terminée : on passe à la ligne suivante
|
131 |
lineIndex++;
|
|
|
133 |
currentLineElem = null;
|
134 |
|
135 |
// Petite pause avant d'attaquer la prochaine ligne
|
136 |
+
setTimeout(() => typeWriter(lines, lineIndex, charIndex), 25);
|
137 |
}
|
138 |
}
|
139 |
|
140 |
// On démarre le « typewriter »
|
141 |
+
typeWriter(lines1, lineIndex, charIndex)
|
142 |
+
|
143 |
+
const lines2 = [
|
144 |
+
"Welcome to",
|
145 |
+
"What Could Possibly Go Wrong in 2025 !",
|
146 |
+
"",
|
147 |
+
"President Trump is actively chatting on X",
|
148 |
+
"sharing his plans with random individuals.",
|
149 |
+
"",
|
150 |
+
"Your role is to manage the ensuing chaos...",
|
151 |
+
"",
|
152 |
+
"You will play as these individuals, responding to his messages.",
|
153 |
+
"Your goal: Convince him not to take actions that could threaten global peace. The map shows other countries' relations with the USA.",
|
154 |
+
];
|
155 |
+
|
156 |
+
setTimeout(() => {
|
157 |
+
while (textContainer.firstChild) {
|
158 |
+
textContainer.removeChild(textContainer.firstChild);
|
159 |
+
}
|
160 |
+
}, 11999)
|
161 |
+
setTimeout(() => typeWriter(lines2, 0, 0), 12000)
|
162 |
</script>
|
163 |
</body>
|
164 |
|
165 |
|
166 |
+
</html>
|