Hello,
In my program I got a guy that can shoot with different weapons(->different damage) at Enemies. The damage variable is stored in the bullet.
If a subclass of the Enemy-class get hit by the bullet it should decrease the enemies hp.
I guess the problem is this part, but I don't know how to replace it:
public void hitEnemy(){ if(isTouching(Enemy.class)){ List<Enemy> enemies = getIntersectingObjects(Enemy.class); Enemy enemy = enemies.get(0); enemy.gotDmg(dmg); } }
List<Enemy> enemies = getIntersectingObjects(Enemy.class); Enemy enemy = enemies.get(0);