-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathshooting.html
47 lines (35 loc) · 1.66 KB
/
shooting.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Space</title>
<meta name="description" content="Space Scene">
<script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
<script src="https://rawgit.com/ngokevin/aframe-layout-component/master/dist/aframe-layout-component.min.js"></script>
<script src="https://unpkg.com/aframe-template-component@^3.1.1/dist/aframe-template-component.min.js"></script>
<script src="./components/projectile.js"></script>
</head>
<body>
<a-scene>
<a-assets>
<img id="enemy-alien" src="./images/alien1.png" />
<script id="enemies" type="text/x-nunjucks-template">
<a-entity layout="type: circle; radius: 5" position="0 0.5 0">
{% for x in range(0, 15) %}
<a-image class="enemy" look-at="#player" src="#enemy-alien" transparent="true">
// collision handler animation
<a-animation attribute="opacity" begin="collider-hit" dur="400" ease="linear" from="1" to="0"></a-animation>
</a-image>
{% endfor %}
<a-animation attribute="rotation" dur="30000" easing="linear" repeat="indefinite" to="0 360 0"></a-animation>
</a-entity>
</script>
<!-- Laser -->
<a-mixin id="laser" geometry="primitive: cylinder; radius: 0.05" material="color: white; metalness: 0.2; roughness: 0.3" rotation="90 0 0" projectile="speed: 0.4" collider="target: .enemy"></a-mixin>
</a-assets>
<a-entity template="src: #enemies"></a-entity>
<a-camera id="player" position="0 1.8 0" spawner="mixin: laser; on: click" click-listener></a-camera>
<a-sky src="./images/galaxy.jpg"></a-sky>
</a-scene>
</body>
</html>