Skip to content

Commit

Permalink
Merge pull request #15 from poeticAndroid/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
poeticAndroid authored Jul 8, 2021
2 parents f2aa288 + 2c0dd4c commit 5362455
Show file tree
Hide file tree
Showing 21 changed files with 599 additions and 163 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Essential game components for [A-Frame](https://aframe.io/)!
<html>
<head>
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/poeticAndroid/a-game@v0.15.0/dist/a-game.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/poeticAndroid/a-game@v0.16.0/dist/a-game.min.js"></script>
</head>
<body>
<a-scene physics>
Expand All @@ -33,6 +33,7 @@ Essential game components for [A-Frame](https://aframe.io/)!
## Components

- [grabbing](./src/components/grabbing.md)
- [button](./src/components/grabbing/button.md)
- [climbable](./src/components/grabbing/climbable.md)
- [fingerflex](./src/components/grabbing/fingerflex.md)
- [grabbable](./src/components/grabbing/grabbable.md)
Expand All @@ -48,5 +49,6 @@ Essential game components for [A-Frame](https://aframe.io/)!
- [body](./src/components/physics/body.md)
- [joint](./src/components/physics/joint.md)
- [shape](./src/components/physics/shape.md)
- [script](./src/components/script.md)
- [trigger](./src/components/trigger.md)

350 changes: 269 additions & 81 deletions dist/a-game.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/a-game.min.js

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@
<title>🎮 A-Game! 👍</title>
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<script src="./a-game.js"></script>

<script src="./scenes/ballmachine.js"></script>
</head>

<body>
<a-scene physics="workerUrl:./cannonWorker.js;">
<a-entity include="./scenes/_assets.html"></a-entity>
<a-player include="./scenes/_player.html">
</a-player>
<a-main include="./scenes/demo.html">
<a-main include="./scenes/ballmachine.html">
<a-box floor color="gray" width="32" height="0.25" depth="32"></a-box>
</a-main>
</a-scene>
Expand Down
2 changes: 1 addition & 1 deletion dist/scenes/ballmachine.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<a-box body="type:kinematic;" color="#def" position="0 -0.5 -8" width="8" height="1" depth="1"
animation="property:rotation; to:0 -360 0; loop:true; easing:linear; dur:5000"></a-box>

<a-sphere position="0 8 -8" ball-spewer></a-sphere>
<a-sphere position="0 8 -8" script="src:./scenes/ballmachine.js"></a-sphere>
<!-- <a-sphere body="type:dynamic;" position="-3 256 -5" radius="0.25" color="red"></a-sphere>
<a-sphere body="type:dynamic;" position="3 256 -11" radius="0.25" color="green"></a-sphere>
<a-sphere body="type:dynamic;" position="3 256 -5" radius="0.25" color="blue"></a-sphere> -->
Expand Down
18 changes: 4 additions & 14 deletions dist/scenes/ballmachine.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
AFRAME.registerComponent("ball-spewer", {
schema: { type: "string" },

({
init() {
setTimeout(() => {
this.el.removeAttribute("ball-spewer")
this.el.removeAttribute("script")
setTimeout(() => {
this.el.setAttribute("ball-spewer", "")
this.el.setAttribute("script", "")
}, 1000 * 60 * 5)
}, 16000)
},
Expand All @@ -32,12 +30,4 @@ AFRAME.registerComponent("ball-spewer", {
let scene = this.el.sceneEl.querySelector("a-main")
scene.appendChild(ball)
}
})
AFRAME.registerComponent("deadvoid", {
schema: { type: "string" },

tick() {
if (this.el.object3D.position.y < -8)
this.el.parentElement.removeChild(this.el)
}
})
})
10 changes: 6 additions & 4 deletions dist/scenes/demo.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<a-main>
<a-main script="src:./scenes/demo.js">
<a-sky src="#skyImg"></a-sky>
<a-entity start position="0 16 1"></a-entity>
<a-entity start position="0 1 1"></a-entity>
<a-box rotation="-90 0 0" src="#floorImg" width="16" height="16" depth="0.01" floor></a-box>
<a-box color="#9fc" position="1.55 .55 -3" scale=".5 .5 .5" grabbable
onevent__reachable="property:color; value:yellow;" onevent__unreachable="property:color; value:blue;"
Expand All @@ -20,8 +20,8 @@
</a-box>
<a-box src="#granite" width="6" depth="0.125" height="20" material="repeat: 6 20" climbable wall position="0 8 9">
</a-box>
<a-cylinder trigger onevent__trigger="entity:#triggerIndicator; property:color; value:green;"
onevent__untrigger="entity:#triggerIndicator; property:color; value:red;" position="-3 1 0" height="2" radius="2"
<a-cylinder trigger onstate__triggered="entity:#triggerIndicator; property:color; on:green; off:red;"
onevent__trigger="entity:a-main; property:script.call; value:inside;" position="-3 1 0" height="2" radius="2"
material="opacity:0.5">
<a-sphere grabbable="physics:false;" id="triggerIndicator" radius="0.125"></a-sphere>
</a-cylinder>
Expand Down Expand Up @@ -59,6 +59,8 @@
<a-sphere radius="0.125" receptacle position="-2 1 0"></a-sphere>
<a-cylinder src="#granite" climbable height="20" position="0 10 4"></a-cylinder>
<a-cylinder src="#granite" floor height="0.125" position="0 20 4"></a-cylinder>
<a-box button onstate__pressed="property:color; off:green; on:lime;" scale="0.125 0.125 0.125" position="4 1 -4">
</a-box>
</a-entity>
<a-box floor src="#granite" position="-8 0 0" scale="2 1 2" body="type:kinematic;"
animation="dur: 20000; property: position; to: -16 0 0; dir: alternate; loop:true;"></a-box>
Expand Down
12 changes: 12 additions & 0 deletions dist/scenes/demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
({
init() {
console.log("Hello demo!")
},

inside() {
console.log("I just went in!")
},
outside() {
console.log("I left!")
},
})
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "a-game",
"title": "A-Game",
"version": "0.15.0",
"version": "0.16.0",
"description": "game components for A-Frame",
"homepage": "https://github.com/poeticAndroid/a-game/blob/master/README.md",
"main": "index.js",
Expand Down
1 change: 1 addition & 0 deletions src/a-game.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ require("./components/locomotion")
require("./components/onevent")
require("./components/onstate")
require("./components/physics")
require("./components/script")
require("./components/trigger")

require("./primitives/a-hand")
Expand Down
Loading

0 comments on commit 5362455

Please sign in to comment.