Commit d57ea417 authored by ogomez92's avatar ogomez92

blah

parent ac6a71d6
......@@ -61,7 +61,7 @@ this.xWall=0;
*/
}
move() {
this.position = [this.x + (Math.cos(this.alpha) * (this.speed)), 0, this.z + (Math.sin(this.alpha) * (this.speed))];
this.position = [this.x + (Math.sin(this.alpha) * (this.speed)), 0, this.z + (Math.cos(this.alpha) * (this.speed))];
this.stepCounter += this.speed;
this.checkWalls();
for (const i of this.world.contents.static) {
......
......@@ -58,8 +58,8 @@ let count=0;
this.result={};
while (!foundWall && count<=amount) { //let's not create unending loops
count++;
this.x=this.x + (Math.cos(this.alpha));
this.z=this.z + (Math.sin(this.alpha));
this.x=this.x + (Math.sin(this.alpha));
this.z=this.z + (Math.cos(this.alpha));
this.distanceToWall++;
//the following if condition checks if either x or z are more than 0 or max grid size.
if (this.x<1 || this.x>this.player.world.size || this.z<1 || this.z>this.player.world.size) {
......
......@@ -6,6 +6,8 @@ import Player from './player';
import {Cone} from './cone';
export default class World {
constructor(game) {
this.prevAlpha=-1;
this.prevPosition=-1;
this.game = game;
this.contents = {
......@@ -36,9 +38,14 @@ this.contents.static.push(new Cone(this));
}
render() {
if (this.prevPosition!=this.player.position) {
panner.setListenerPosition(this.player.x,this.player.y,this.player.z);
//panner.setListenerOrientation(Math.sin(this.player.alpha), 0, Math.cos(this.player.alpha));
panner.setListenerOrientation(Math.cos(this.player.alpha), 0, Math.sin(this.player.alpha));
this.prevPosition=this.player.position;
}
if (this.prevAlpha!=this.player.alpha) {
panner.setListenerOrientation(Math.sin(this.player.alpha), 0, Math.cos(this.player.alpha));
this.prevAlpha=this.player.alpha;
}
for (const i of this.contents.dynamic) {
if (typeof i.sound !== undefined) {
i.sounds.update({x: i.x, y: i.y, z: i.z});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment