Hello, I just need help for a touch and avoid game. Can someone help me make a script for when I reach a certain value, then it changes to another world, and if in the 2nd world I get a certain score then the game ends.
Here's my code in my world,
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Game2 here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Game1 extends World
{
Counter counter = new Counter();
/**
* Constructor for objects of class Game2.
*
*/
public Game1()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 400, 1);
addObject(new Gazelle(), Greenfoot.getRandomNumber(getWidth()), Greenfoot.getRandomNumber(getHeight()));
addObject(new Lion(), Greenfoot.getRandomNumber(getWidth()), Greenfoot.getRandomNumber(getHeight()));
addObject (counter, 100, 40);
for (int x= 0; x < 10; x++)
{
addObject(new Flower(), Greenfoot.getRandomNumber(getWidth()), Greenfoot.getRandomNumber(getHeight()));
}
}
public Counter getCounter()
{
return counter;
}
}
