Hi I'm trying to add on screen messages if the character dies, but I can't seem to get it to work. I've tried multiple methods.
Thanks in advance.
public class Two_Player extends World
{
private Actor[] players;
private Yellow_Crushed yellow_crushed;
/**
* Constructor for objects of class MyWorld.
*
*/
public Two_Player()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(1366, 768, 1);
prepare();
//display1();
display2();
}
/**
* Prepare the world for the start of the program.
* That is: create the initial objects and add them to the world.
*/
private void prepare()
{
//Yellow yellow = new Yellow();
//addObject(yellow,163,610);
Crusher_1 crusher_1 = new Crusher_1();
addObject(crusher_1,215,162);
Crusher_2 crusher_2 = new Crusher_2();
addObject(crusher_2,406,162);
Crusher_3 crusher_3 = new Crusher_3();
addObject(crusher_3,598,162);
Crusher_4 crusher_4 = new Crusher_4();
addObject(crusher_4,786,162);
Crusher_5 crusher_5 = new Crusher_5();
addObject(crusher_5,975,162);
Crusher_6 crusher_6 = new Crusher_6();
addObject(crusher_6,1164,162);
//Yellow_Crushed yellow_Crushed = new Yellow_Crushed();
//addObject(yellow_Crushed,1164,162);
}
public void display1()
{
if (players == null)
{
players = new Actor[] { new Yellow(), new Blue() };
addObject(players[0],163,610);
addObject(players[1],163,610);
//players = new Actor[] { new Yellow(), new SurvivorARROW() };
addObject(new Yellow_Crushed(), 695, 393);
}
}
public void display2()
{
Yellow yellow = new Yellow();
addObject(yellow,163,610);
if (getObjects(Players.class).isEmpty())
{
addObject (new Yellow_Crushed(), 695, 393);
}
}
}

