Hey, how can I make a score counter ? I wanna get 10 point after 1 Vcela died
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Louka here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Louka extends World
{
public void pridejVcelu()
{
Vcela v = new Vcela();
int x = Greenfoot.getRandomNumber(this.getWidth());
int y = Greenfoot.getRandomNumber(this.getHeight());
this.addObject(v, x, y);
}
public Louka()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(1177, 768, 1);
for(int i=0; i<10; i++)
{
this.pridejVcelu();
}
}
private int timer = 4000;
public void act() {
timer--;
if (timer <= 0) {
Greenfoot.stop(); // pause the execution of the program if 'timer' is less than or equal to 0
}
}
public void smazVcely()
{
int x = Greenfoot.getRandomNumber(this.getWidth());
int y = Greenfoot.getRandomNumber(this.getHeight());
removeObjects(getObjects(null));
for(int i=0; i<10; i++)
{
this.pridejVcelu();
}
}
}