updated where descriptions get written on screen
This commit is contained in:
parent
fb98a82d6b
commit
fe72849f64
26
village.js
26
village.js
|
@ -76,11 +76,12 @@ function loop(){
|
|||
|
||||
checkKeys(key);
|
||||
|
||||
checkCollision();
|
||||
|
||||
updateDungeon();
|
||||
drawDungeon();
|
||||
program.setx(1);
|
||||
|
||||
checkCollision();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -154,32 +155,37 @@ function inv(){
|
|||
|
||||
for (let i = 0; i < inventory.length; i++){
|
||||
program.setx(0);
|
||||
program.down(10);
|
||||
program.down(2);
|
||||
program.write(inventory[i].symbol+": "+inventory[i].description);
|
||||
}
|
||||
}
|
||||
|
||||
function checkCollision() {
|
||||
|
||||
program.bg('red');
|
||||
|
||||
//check Collision with Items
|
||||
for (let i = 0; i < roomItems.length; i++){
|
||||
if ((player.position.x == roomItems[i].position.x) && (player.position.y == roomItems[i].position.y)){
|
||||
console.log("you collided with "+roomItems[i].name);
|
||||
console.log(roomItems[i].name);
|
||||
console.log(roomItems[i].description);
|
||||
//program.down(5);
|
||||
//program.write(roomItems[i].name);
|
||||
//program.write(roomItems[i].description);
|
||||
program.setx(1)
|
||||
program.down(1)
|
||||
program.write(roomItems[i].name);
|
||||
program.setx(1)
|
||||
program.down(2)
|
||||
program.write(roomItems[i].description);
|
||||
program.down(1)
|
||||
}
|
||||
}
|
||||
|
||||
//check Collision with Places
|
||||
for (let i = 0; i < places.length; i++){
|
||||
if ((player.position.x == places[i].position.x) && (player.position.y == places[i].position.y)){
|
||||
console.log(places[i].name); //player is standing at this place
|
||||
//program.write(places[i].name);
|
||||
//player is standing at this place
|
||||
program.write(places[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
program.bg('!red');
|
||||
}
|
||||
|
||||
function resetScreen(){
|
||||
|
|
Loading…
Reference in New Issue