import lang.stride.*;
import java.util.*;
import greenfoot.*;
/**
*
*/
public class MyWorld extends World
{
Counter counter = new Counter();
/**
* Constructor for objects of class MyWorld.
*/
public MyWorld()
{
super(900, 600, 1);
prepare();
}
public Counter GetCounter()
{
return counter;
}
/**
* Prepare the world for the start of the program.
* That is: create the initial objects and add them to the world.
*/
private void prepare()
{
addObject(counter, 50, 50);
Emoti1 emoti1 = new Emoti1();
addObject(emoti1, 130, 114);
Emoti2 emoti2 = new Emoti2();
addObject(emoti2, 330, 115);
Counter counter = new Counter();
addObject(counter, 38, 49);
counter.setLocation(345,47);
counter.setLocation(135,46);
removeObject(counter);
}
}
import lang.stride.*;
import java.util.*;
import greenfoot.*;
/**
*
*/
public class Counter extends Actor
{
/**
* Act - do whatever the Counter wants to do. This method is called whenever the 'Act' or 'Run' button gets pressed in the environment.
*/
int score = 0;
public void act()
{
setImage(new GreenfootImage("Score :" + score, 20, Color.WHITE, Color.BLACK));
}
public void addScore()
{
score++;
}
}


