This site requires JavaScript, please enable it in your browser!
Greenfoot back
Sidstar
Sidstar wrote ...

2012/6/7

I'm Stuck Please Help As Soon as Possible!

Sidstar Sidstar

2012/6/7

#
Hi there, I Have seen in the scenarios people are making and I was wondering how the change the camera view or like the camera follows where the "Actor" is going. I think people are calling it the 3D effect. Also I was wondering is it possible to change worlds while the game is running (eg. change world for different levels) Thanks
tylers tylers

2012/6/7

#
for your second question. use this
Greenfoot.setWorld(new ......()); 
Sidstar Sidstar

2012/6/7

#
tylers wrote...
for your second question. use this
Greenfoot.setWorld(new ......()); 
Thanks i will try but when will the world change can u give me an example after 40 seconds or if all Actor class's are shoot down by another actor class Thanks
danpost danpost

2012/6/8

#
Use this statement:
if (timeElapsed() || getWorld().getObjects(NameOfClass.class).isEmpty()) Greenfoot.setWorld(new NameOfWorld());
and add these variable, plus the following method:
static final int MAX_TIME = 2000; // adjust to suit
boolean timerOn = true;
int timeCount = 0;

private boolean timeElapsed()
{
    if (!timerOn) return false;
    timeCount++;
    if (timeCount >= MAX_TIME)
    {
        timerOn = false;
        timeCount = 0;
        return true;
    }
    return false;
}
To re-run this timer, just set 'timerOn' back to 'true'.
You need to login to post a reply.