2
0
forked from s444420/AL-2020

funckja getDistane

This commit is contained in:
Wojciech Łukasik 2020-04-28 13:49:03 +02:00
parent c471a54cb7
commit bed895d67d
2 changed files with 12 additions and 6 deletions

View File

@ -13,7 +13,6 @@
<div class="board" id="board">
</div>
</div>
<script type="module" src="./js/main.js"></script>
</div>
</body>
</html>

View File

@ -64,7 +64,6 @@ class Agent{
}
showAgent(){
console.log(this.turn)
if(this.turn === "Up"){
document.getElementById(this.positionX + "-" + this.positionY).style.backgroundImage = "url('img/Up.png')";
}
@ -228,16 +227,24 @@ function showBoard(board){
}
}
function getDistance(x1,y1,x2,y2){
var a = x1 - x2;
var b = y1 - y2;
var c = Math.sqrt(a*a + b*b);
return c
}
let board = createBoard(10,10);
board = createShelf(board);
let agent = new Agent(0,0, 'Right');
function start(){
let board = createBoard(10,10);
let agent = new Agent(0,0, 'Right');
showBoard(board);
agent.showAgent()
agent.showAgent();
console.log(getDistance(2,1,0,3))
}