Spaces:
Running
Running
WatchOutForMike
commited on
Commit
β’
aec03ee
1
Parent(s):
02274f2
Update main.js
Browse files
main.js
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
const { Alpine } = window.Alpine; const { Daisy } = window.Daisy;
|
2 |
|
3 |
-
(() => { const root = document.getElementById("app"); root.innerHTML = ${root.innerHTML} {{#each wrestler in wrestlers}}
|
|
|
|
|
|
|
4 |
|
5 |
function onWrestlerClick(wrestler) { console.log(Clicked on wrestler ${wrestler.name}); alert(You clicked on wrestler ${wrestler.name}); playSound("wrestling_bell"); updateGameState(wrestler); }
|
6 |
|
@@ -14,4 +17,92 @@ function onMoveClick(move) { console.log(Clicked on move ${move.name}); alert(Yo
|
|
14 |
|
15 |
function updateMove(move) { // Add code to update the move in the game state }
|
16 |
|
17 |
-
console.log("DaisyUI loaded");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
const { Alpine } = window.Alpine; const { Daisy } = window.Daisy;
|
2 |
|
3 |
+
(() => { const root = document.getElementById("app"); root.innerHTML = ${root.innerHTML} {{#each wrestler in wrestlers}}
|
4 |
+
${wrestler.name}
|
5 |
+
onWrestlerClick(wrestler)}">Play
|
6 |
+
{{/each}}; })();
|
7 |
|
8 |
function onWrestlerClick(wrestler) { console.log(Clicked on wrestler ${wrestler.name}); alert(You clicked on wrestler ${wrestler.name}); playSound("wrestling_bell"); updateGameState(wrestler); }
|
9 |
|
|
|
17 |
|
18 |
function updateMove(move) { // Add code to update the move in the game state }
|
19 |
|
20 |
+
console.log("DaisyUI loaded");
|
21 |
+
|
22 |
+
// Additional functionality
|
23 |
+
|
24 |
+
function updateGameState(wrestler) { // Add code to update the game state with the selected wrestler }
|
25 |
+
|
26 |
+
function playSound(soundName) { // Add code to play a sound effect using the soundName }
|
27 |
+
|
28 |
+
function updateMove(move) { // Add code to update the move in the game state }
|
29 |
+
|
30 |
+
// Additional CSS
|
31 |
+
|
32 |
+
.game-board { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; margin: 20px; background-color: #f7f7f7; border-radius: 10px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
|
33 |
+
|
34 |
+
.game-board #gameboard { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; margin: 20px; background-color: #f7f7f7; border-radius: 10px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
|
35 |
+
|
36 |
+
.game-board #scoreboard { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; margin: 20px; background-color: #f7f7f7; border-radius: 10px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
|
37 |
+
|
38 |
+
.game-board #countdown { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; margin: 20px; background-color: #f7f7f7; border-radius: 10px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
|
39 |
+
|
40 |
+
.game-board #moves { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; margin: 20px; background-color: #f7f7f7; border-radius: 10px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
|
41 |
+
|
42 |
+
.game-board #moves h2 { font-size: 18px; font-weight: bold; color: #333; margin-bottom: 10px; }
|
43 |
+
|
44 |
+
.game-board .move { padding: 10px; margin: 10px; background-color: #ffc107; border-radius: 10px; cursor: pointer; }
|
45 |
+
|
46 |
+
.game-board .move:hover { background-color: #ffc107; }
|
47 |
+
|
48 |
+
.game-board .move:active { background-color: #ffc107; }
|
49 |
+
|
50 |
+
.game-board .move:focus { outline: none; }
|
51 |
+
|
52 |
+
.footer { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; margin: 20px; background-color: #f7f7f7; border-radius: 10px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
|
53 |
+
|
54 |
+
.footer p { font-size: 16px; color: #666; margin-bottom: 20px; }
|
55 |
+
|
56 |
+
.footer a { color: #4CAF50; text-decoration: none; cursor: pointer; }
|
57 |
+
|
58 |
+
.footer a:hover { color: #45a049; }
|
59 |
+
|
60 |
+
.footer a:active { color: #3e8e41; }
|
61 |
+
|
62 |
+
.footer a:focus { outline: none; }
|
63 |
+
|
64 |
+
// Additional HTML
|
65 |
+
|
66 |
+
Made with π» by Max
|
67 |
+
|
68 |
+
// Additional JavaScript
|
69 |
+
|
70 |
+
const gameBoard = document.getElementById("gameboard"); const scoreboard = document.getElementById("scoreboard"); const countdown = document.getElementById("countdown"); const moves = document.getElementById("moves");
|
71 |
+
|
72 |
+
const moveButtons = moves.querySelectorAll(".move");
|
73 |
+
|
74 |
+
moveButtons.forEach((button) => { button.addEventListener("click", () => { playSound("move_sound"); updateMove(button.id); }); });
|
75 |
+
|
76 |
+
function updateMove(move) { // Add code to update the move in the game state }
|
77 |
+
|
78 |
+
function playSound(soundName) { // Add code to play a sound effect using the soundName }
|
79 |
+
|
80 |
+
function updateGameState(wrestler) { // Add code to update the game state with the selected wrestler }
|
81 |
+
|
82 |
+
function onMoveClick(move) { console.log(Clicked on move ${move.name}); alert(You selected the ${move.name} move); updateMove(move); }
|
83 |
+
|
84 |
+
function onWrestlerClick(wrestler) { console.log(Clicked on wrestler ${wrestler.name}); alert(You clicked on wrestler ${wrestler.name}); playSound("wrestling_bell"); updateGameState(wrestler); }
|
85 |
+
|
86 |
+
function playSound(soundName) { // Add code to play a sound effect using the soundName }
|
87 |
+
|
88 |
+
function updateGameState(wrestler) { // Add code to update the game state with the selected wrestler }
|
89 |
+
|
90 |
+
function onMoveClick(move) { console.log(Clicked on move ${move.name}); alert(You selected the ${move.name} move); updateMove(move); }
|
91 |
+
|
92 |
+
function onWrestlerClick(wrestler) { console.log(Clicked on wrestler ${wrestler.name}); alert(You clicked on wrestler ${wrestler.name}); playSound("wrestling_bell"); updateGameState(wrestler); }
|
93 |
+
|
94 |
+
// Update the game state with the selected wrestler updateGameState(wrestler);
|
95 |
+
|
96 |
+
// Update the game state with the selected move updateMove(move);
|
97 |
+
|
98 |
+
// Play the move sound effect playSound("move_sound");
|
99 |
+
|
100 |
+
// Play the wrestling bell sound effect playSound("wrestling_bell");
|
101 |
+
|
102 |
+
// Update the game board with the selected wrestler gameBoard.innerHTML = <div class="wrestler"> <h3>${wrestler.name}</h3> <button class="btn btn-success" @click="${() => onWrestlerClick(wrestler)}">Play</button> </div>;
|
103 |
+
|
104 |
+
// Update the scoreboard with the selected wrestler scoreboard.innerHTML = <h2>Scoreboard</h2> <ul> <li>${wrestler.name}: 0</li> </ul>;
|
105 |
+
|
106 |
+
// Update the countdown with the selected wrestler countdown.innerHTML = <h2>Countdown</h2> <div> <p>${wrestler.name}</p> <p>0:00</p> </div>;
|
107 |
+
|
108 |
+
// Update the moves with the selected wrestler moves.innerHTML = <h2>Moves</h2> <ul> <li>${wrestler.name}: ${move.name}</li> </ul>;
|