research collision

This commit is contained in:
StrangeD0s
2023-02-19 13:26:45 +01:00
parent 09cb6bb5fd
commit a8fe40fd19
2 changed files with 7 additions and 0 deletions
+3
View File
@@ -49,9 +49,12 @@ function updateMonster(monster, dt) {
if (!monster.dead) {
updateEntity(monster, dt)
console.log('log TILE ', TILE)
// ! TILE ist immer nur eine feste Zahl "16"
if (
overlap(player.x, player.y, TILE, TILE, monster.x, monster.y, TILE, TILE)
) {
// ! Erklärung wie das hier funktioniert und evtl. eine allgemeine Funktion daraus machen, die prüft, ob etwas Vertikal kollidiert.
if (player.dy > 0 && monster.y - player.y > TILE / 2) killMonster(monster)
else if (player.vul) {
reduceHitpoints(player, 1)