Skip to content

Commit

Permalink
Game loop test
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanisgrox committed Dec 28, 2023
1 parent 88e51ab commit de37700
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions roguelike.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,17 @@ function HPChange (target, amount) {
}
}

GenerateTiles();
GenerateRooms();
GeneratePasses();
PlaceGoods (objectProps);
function gameLoop () {
console.log('tick');

Enemies.forEach((enemy) => {

});

setTimeout(() => gameLoop(), 500);
}



document.addEventListener('keydown', (e) => {
switch (e.code) {
Expand All @@ -297,9 +304,9 @@ document.addEventListener('keydown', (e) => {
}
})

document.addEventListener('click', (e) => {
let x = Number(e.target.id.split('-')[0]);
let y = Number(e.target.id.split('-')[1]);
console.log(getCoordinates('E.8'));
HPChange('P', -1)
})

GenerateTiles();
GenerateRooms();
GeneratePasses();
PlaceGoods (objectProps);
gameLoop();

0 comments on commit de37700

Please sign in to comment.