-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.html
80 lines (73 loc) · 2.64 KB
/
game.html
1
2
3
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Pop on click Exponents & Roots Rules</title>
<meta name="description" content="Click the Cubes to Display the rules" />
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/aframe-environment-component.min.js"></script>
</head>
<body>
<a-scene background="color: #ECECEC" environment="preset: goldmine">
<!-- Camera with cursor -->
<a-entity
id="camera"
position="0 1.6 0"
camera
look-controls
wasd-controls
>
<a-cursor color="#333" maxdistance="30"></a-cursor>
</a-entity>
<!-- Images to show/hide -->
<a-image
id="imageP"
material="src:https://cdn.glitch.global/a379a0e4-c968-4340-8889-776d5b7d280a/RegrasPot%C3%AAncias.jpeg?v=1715084112875; transparent:true"
position="3.5 4.5 -5"
scale="5 5 0"
visible="false"
></a-image>
<a-image
id="imageR"
material="src:https://cdn.glitch.global/a379a0e4-c968-4340-8889-776d5b7d280a/RaizesRegras.jpeg?v=1715084112395; transparent:true"
position="-3.5 4.5 -5"
scale="5 5 0"
visible="false"
></a-image>
<!-- Cubes to click -->
<a-box id="cubeP" color="brown" position="1 2 -5"></a-box>
<a-box id="cubeR" color="blue" position="-1 2 -5"></a-box>
<!-- Create light -->
<a-entity
id="lightSphere"
geometry="primitive: sphere"
material="color: cyan; shader: flat"
light="type: point"
position="4 50 -116"
scale="10 10 10"
></a-entity>
</a-scene>
<script>
// When the window is fully loaded, run the function
window.onload = function () {
// Get the cubeP, cubeR, imageP, and imageR elements
var cubeP = document.getElementById("cubeP");
var cubeR = document.getElementById("cubeR");
var imageP = document.getElementById("imageP");
var imageR = document.getElementById("imageR");
// Add a click event listener to cubeP
cubeP.addEventListener("click", function () {
// Toggle visibility of imageP
var isVisible = !imageP.getAttribute("visible");
imageP.setAttribute("visible", isVisible);
});
// Add a click event listener to cubeR
cubeR.addEventListener("click", function () {
// Toggle visibility of imageR
var isVisible = !imageR.getAttribute("visible");
imageR.setAttribute("visible", isVisible);
});
};
</script>
</body>
</html>