Fix: Game crasht nicht mehr bei damage auf 0 Leben und PowerUps werden wieder gelöscht wenn sie den unteren Fensterrand
This commit is contained in:
Binary file not shown.
@@ -57,8 +57,8 @@ public class MyWorld extends World
|
|||||||
plattform2.setLocation(320,367);
|
plattform2.setLocation(320,367);
|
||||||
plattform2.setLocation(312,371);
|
plattform2.setLocation(312,371);
|
||||||
plattform2.setLocation(308,382);
|
plattform2.setLocation(308,382);
|
||||||
Healthbar healthbar = new Healthbar();
|
//Healthbar healthbar = new Healthbar();
|
||||||
addObject(healthbar,50,50);
|
//addObject(healthbar,50,50);
|
||||||
Heart heart = new Heart();
|
Heart heart = new Heart();
|
||||||
addObject(heart,371,27);
|
addObject(heart,371,27);
|
||||||
Heart heart2 = new Heart();
|
Heart heart2 = new Heart();
|
||||||
|
|||||||
Binary file not shown.
@@ -121,9 +121,11 @@ public class Player extends Actor
|
|||||||
getWorld().removeObjects(getWorld().getObjects(Spike.class));
|
getWorld().removeObjects(getWorld().getObjects(Spike.class));
|
||||||
|
|
||||||
getWorld().removeObjects(getIntersectingObjects(Spike.class));
|
getWorld().removeObjects(getIntersectingObjects(Spike.class));
|
||||||
|
if (getWorld().getObjects(Heart.class) != null){
|
||||||
getWorld().removeObject(getWorld().getObjects(Heart.class).get(0));
|
getWorld().removeObject(getWorld().getObjects(Heart.class).get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void checkHealth(){
|
public void checkHealth(){
|
||||||
if (health <= 0){
|
if (health <= 0){
|
||||||
|
|||||||
Binary file not shown.
@@ -34,8 +34,8 @@ public class PowerUps extends Actor
|
|||||||
|
|
||||||
public void moveDown()
|
public void moveDown()
|
||||||
{
|
{
|
||||||
this.setLocation(this.getX(), this.getY()+2);
|
setLocation(this.getX(), this.getY()+2);
|
||||||
if(this.getY()>=this.getWorld().getHeight())
|
if(this.getY() >= getWorld().getHeight()-1)
|
||||||
{
|
{
|
||||||
deleteAfterActCycle = true;
|
deleteAfterActCycle = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user