Updated Items and added the first advanced Item-Icons

This commit is contained in:
Licht 2014-11-18 13:08:08 +01:00
parent f75a93b5cf
commit 4e3964c31c
6 changed files with 16 additions and 8 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 370 B

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 310 B

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -125,4 +125,12 @@ public class Player extends ShootingEntity implements KeyboardListener {
return (int) this.shieldPercent;
}
public void increaseHealthPoints(int inc) {
if (this.getHealthPoints() <= 85) {
this.setHealthPoints(getHealthPercent() + inc);
} else {
this.setHealthPoints(100);
}
}
}

View File

@ -24,6 +24,12 @@ public abstract class Item extends CollidableEntity {
public void collideWith(Collidable entity) {
if(entity instanceof Player) {
SoundSystem.playSound("sounds/powerup_pickup.wav");
while(entityIterator.hasNext()) {
Entity e = entityIterator.next();
if(e instanceof Player){
itemCollected((Player) e);
}
}
this.remove();
}
}
@ -34,12 +40,6 @@ public abstract class Item extends CollidableEntity {
this.remove();
};
entityIterator.reset();
while(entityIterator.hasNext()) {
Entity e = entityIterator.next();
if(e instanceof Player){
itemCollected((Player) e);
}
}
}
public abstract void itemCollected(Player player);

View File

@ -6,7 +6,7 @@ public class TestItem1 extends Item {
public TestItem1(int x, int y) {
super(x, y);
this.setImage("images/items/item.png");
this.setImage("images/items/item4.png");
}
@Override

View File

@ -13,6 +13,6 @@ public class TestItem3 extends Item {
@Override
public void itemCollected(Player player) {
player.setShootDamage(player.getShootDamage()+5);
player.increaseHealthPoints(15);
}
}