Commit a370f047 authored by ogomez92's avatar ogomez92

move

parent 848eedb2
......@@ -17,7 +17,8 @@ charset="utf-8"/>
</head>
<body aria-role="application">
<body role="application">
<div id="speech" class="speechArea" aria-live="polite"></div>
Welcome to the game! If you cannot use your arrow keys press insert space or insert z depending on your screen reader to turn off browse mode.<p> </p>
</body>
</html>
\ No newline at end of file
......@@ -60,7 +60,7 @@ class Game {
if (this.input.isJustPressed(KeyEvent.DOM_VK_X))
{
//speech.speak(this.world.player.alpha + ', ' + 'x' + this.world.player.x + ', z' + this.world.player.z);
speech.speak(this.world.player.alpha*180/Math.PI);
speech.speak(this.world.player.alpha*180/Math.PI+", "+this.world.player.dir);
}
}
}
......
......@@ -13,6 +13,7 @@ export const utils = new GameUtils();
export default class Player {
constructor(world) {
this.frontRay = new Ray(this);
this.dir=0;
this.lWall = 1;
this.rWall = 1;
this.passageRight=son.create("passage");
......@@ -57,6 +58,13 @@ export default class Player {
}
update() {
let deg;
//right
deg=this.alpha*180/Math.PI;
if (deg>269) this.dir=4;
else if (deg<270 && deg>=179) this.dir=3;
else if (deg<180 && deg>=90) this.dir=3;
else if (deg<90 && deg>=0) this.dir=3;
this.car.update();
this.frontRay.scan();
}
......
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