danpost wrote...
Ok. Now remove lines 11 and 22 from the Start class and show your Counter class code.import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) import java.awt.Color; /** * Write a description of class Counter here. * * @author (your name) * @version (a version number or a date) */ public class Counter extends Actor { private static int score; public static int level; /** * Act - do whatever the Counter wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { setImage(new GreenfootImage("Score: "+ score,24, Color.RED, Color.BLACK)); // this sets the image to say Score but then add what ever the score is so it may look like this Score:10 and at the start it looks like Score:0 } public void addScore() { score++; // this code adds a score of 1 each time an Rock is killed if (score == 3 // need to make a level varible ){ Greenfoot.setWorld(new L2()); level=1; score= 4; // This code changes the back ground to level 2 when 3 points are scored } if (score == 20){ Greenfoot.setWorld(new L3()); level =2; score=21; //This code changes the back ground to level 3 when 20 points are scored } if (score == 30){ Greenfoot.setWorld(new Finished()); score=0; //This code changes the back ground to the finished screen when 30 points are scored } } public void reset() { score =0; } }
public Counter() { update(); }