i am trying to get the int vie from Calamitas and show it in my death screan(EcranDeMort) but i cant get it with getObjects(Calamitas.class).get(vie); because it isn't in the world EcranDeMort.
my code from my EcranDeMort:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class ecrandemort here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class EcranDeMort extends World
{
MessageDeMort MessageMort;
int vie = getObjects(Calamitas.class).get(vie);
/**
* Constructor for objects of class ecrandemort.
*
*/
public EcranDeMort()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(800, 800, 1);
MessageMort = new MessageDeMort();
addObject(MessageMort,400,200);
showText("Il restais ", 400, 400);
}
}
the relevent code from Calamitas:
Actor Bl = (Actor)getWorld().getObjects(Blahaj.class).get(0);
if (Bl.getImage().getTransparency() == 0){
setRotation(0);
peuAttaque = false;
rep = 40;
musiquePhase1.stop();
musiquePhase2.stop();
if(peuJouerSon == true){
tuAPerdu.play();
peuJouerSon = false;
}
if(timer > animation + 100 && tuAPerdu.isPlaying() && rep > 0){
animation = timer;
setLocation(getX(),getY()+1);
rep--;
}else if(timer > animation + 100 && ! tuAPerdu.isPlaying() && sonDisparition == true){
im.setTransparency(0);
disparition.play();
for(int j = 0; j<20; j++){
getWorld().addObject(new particule(), getX(), getY());
}
sonDisparition = false;
animation = timer;
}else if(timer > animation + 1000 && sonDisparition == false){
EcranDeMort EcranDeMort = new EcranDeMort();
Greenfoot.setWorld(EcranDeMort);
}
}
tanks in advance