Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reload + Share feature + UI changes [basic] #3

Merged
merged 1 commit into from
Jul 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Reload Test
Added Reload feature + *test* basic share feature
Added UI Changes
Design Changes
  • Loading branch information
GeekyShiva committed Jul 4, 2019
commit 51c7b7b15b0a5dd627b7bc6b28400eea3b613675
Binary file modified assets/msg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/msg1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 22 additions & 3 deletions game.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<script src="libs/lz-string.min.js"></script>

<script src="src/common.js"></script>
<script src="src/reload.js"></script>

</head>
<body>
Expand All @@ -21,24 +22,41 @@
<img src="assets/roof.jpg" id="asset_roof">
<img src="assets/ground.jpg" id="asset_ground">
<img src="assets/msg.jpg" id="asset_msg">
<img src="assets/msg1.png" id="asset_msg1">
</a-assets>
<a-entity sound="src: url(assets/backgroundnoise.mp3); autoplay: true; loop:true; distanceModel:linear"></a-entity>
<a-entity static-body
sound="src: url(src/bat.mp3); on: collide; volume:0.2; refDistance: 0.5"
sound="src: url(src/bat.mp3); on: collide; volume:0.1;"
velocity="0 0 0"
rotation="0 0 0"
position="0 1.6 -2"
id="camera"
camera=""
kinematic-body
universal-controls>
<a-entity cursor="fuse: true; fuseTimeout: 500"
position="0 0 -1"
geometry="primitive: ring; radiusInner: 0.02; radiusOuter: 0.03"
material="color:green; shader: flat">
</a-entity>
<!-- <a-box id="boxId" position="0 0.5 -3" rotation="0 45 0" color="blue"></a-box> -->
<a-entity text="text: Time;size:.03;height:0.001" material="color:#f00" position="-0.1 -0.7 -1" id="board"></a-entity>
<a-entity text="text: ;size:.1;height:0.001" material="color:#78ff0f" position="-0.3 0 -1" id="winner"></a-entity>
</a-entity>

</a-scene>


<script>

AFRAME.registerComponent('on-click', {
init: function () {
this.el.addEventListener('click', function (evt) {
location.reload();
});
}
});

var maze;

var cam = document.getElementById('camera');
Expand All @@ -53,6 +71,7 @@
}
});


var seconds = 0;
var counter;

Expand Down Expand Up @@ -93,4 +112,4 @@
</script>

</body>
</html>
</html>
447 changes: 447 additions & 0 deletions libs/aframe.min.js

Large diffs are not rendered by default.

31 changes: 24 additions & 7 deletions src/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,31 @@
cam.setAttribute('position',(3*(free2-(maze_width-1)*.5))+' 1.6 '+(3*(free1-(maze_height-1)*.5)));

// Print instructions
var plane_instructions = document.createElement("a-plane");
var plane_instructions = document.createElement("a-box");
plane_instructions.setAttribute('height',1.5);
plane_instructions.setAttribute('width',3);
plane_instructions.setAttribute('look-at','#camera');
plane_instructions.setAttribute('rotation','0 90 0');
plane_instructions.setAttribute('position',(3*(free2-(maze_width-1)*.5))+' 1 '+(3*(free1-(maze_height-1)*.5)));
plane_instructions.setAttribute('material','src: #asset_msg;side: double;repeat: 1 1');

scene.appendChild(plane_instructions);
// console.log((3*(free2-(maze_width-1)*.5))+' 1 '+(3*(free1-(maze_height-1)*.5)));
plane_instructions.setAttribute('material','src: #asset_msg;');
/* plane_instructions.setAttribute('material','src: #asset_msg;side: double;repeat: 1 1'); */
scene.appendChild(plane_instructions);


//reload
var reload = document.createElement("a-box");
reload.setAttribute('on-click','');
reload.setAttribute('height',0.3);
reload.setAttribute('width',0.3);
reload.setAttribute('look-at','#camera');
reload.setAttribute('rotation','0 90 0');
reload.setAttribute('position','-25.5 2 -19');
// console.log((3*(free2-(maze_width-1)*.5))+' 1 '+(3*(free1-(maze_height-1)*.5)));
reload.setAttribute('material','src: #asset_msg1;');
/* plane_instructions.setAttribute('material','src: #asset_msg;side: double;repeat: 1 1'); */

scene.appendChild(reload);

// Set final portal position
var free1=maze_height-1,free2=maze_width-1;
Expand All @@ -221,16 +237,17 @@
}
}

// Print blue portal
// door
var box_price = document.createElement("a-box");
box_price.setAttribute('static-body','');
box_price.setAttribute('src','#door');
box_price.setAttribute('id','price');
box_price.setAttribute('height',3);
box_price.setAttribute('width',1.5);
box_price.setAttribute('height',2);
box_price.setAttribute('width',1);
// box_price.setAttribute('depth',1);
box_price.setAttribute('rotation','0 0 0');
box_price.setAttribute('position',(3*(free2-(maze_width-1)*.5))+' 1 '+(3*(free1-(maze_height-1)*.5)));
console.log((3*(free2-(maze_width-1)*.5))+' 1 '+(3*(free1-(maze_height-1)*.5)));
// box_price.setAttribute('color','#00f');

scene.appendChild(box_price);
Expand Down