/** * checks for enemy/bomb collison , kills player if true * * @cm collision map */ @Override public void update(BufferedImage cm) { if (simpleHasColl(posX, posY, map.getCollisionMap(), Color.orange, Color.red)) { if (!immortal) { if (!shieldProtection) { if (!remotePlayer) { this.die(); if (!inMultiplayerMode) map.finishMap(); } } else { if (!shieldHit) { shieldStartTime = System.nanoTime(); shieldHit = true; shieldEqu = false; System.out.println("Shield hit"); } } } else { System.out.println("Hit, but immortal. Muhaha"); } } if (shieldHit) { if (shieldStartTime + shieldTime <= System.nanoTime()) { shieldProtection = false; shieldHit = false; animation.setCurrentAnimation(animation.getCurrentImagePath()); System.out.println("Shield off"); } } if (immortal) { if (immortalStartTime + immortalTime <= System.nanoTime()) { immortal = false; animation.setCurrentAnimation(animation.getCurrentImagePath()); System.out.println("Now you are not immortal anymore"); } } animation.animate(); move(); // checkUpgradeCollision(cm); wird durch handleUpgrades ersetzt }