This site requires JavaScript, please enable it in your browser!
Greenfoot
Username
Password
Remember Me?
Sign Up, Lost Password
Activity
About
Documentation
Download
Discuss
Scenarios
What is happening right now?
Latest Scenarios
optimized3
optimized2
Bloodstream
Kingdom: Live i...
optimized
123
more
Popular Scenarios
Plants Vs Zombi...
Spacebear
Kingdom: Live i...
Frog
evil crocodile
car
more
Popular Users
more
Popular Collections
Optical Illusions
Reusable actors...
Scenario showcase
Demos by danpost
more
trying to get an int from an actor in a different world to show it in the end
By Alizee, with no replies.
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
New Scenario: optimized3
By JalynPerry - about 8 hours ago
test
New Scenario: optimized2
By JalynPerry - about 8 hours ago
test
New Scenario: Bloodstream
By average_ham - about 10 hours ago
Update: Kingdom: Live into Another World
By Arfer - about 13 hours ago
New Scenario: optimized
By JalynPerry - about 17 hours ago
test
New Scenario: 123
By JalynPerry - about 18 hours ago
test
New Scenario: game3
By Unubileg - about 18 hours ago
New Scenario: game3
By munkh-ireedui - about 18 hours ago
New Scenario: ........
By JalynPerry - about 18 hours ago
Update: game3
By Tuvshinzaya - about 18 hours ago
Update: game2
By Temuulen - about 18 hours ago
it eat so hard
X