For the final part of my game, i need a counter that always goes up until I die so kinda like a timer (000000) goes up 100 points a second.
int score = 0; /** * 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,60, Color.GREEN, Color.YELLOW)); addScore(); } public void addScore() { score++; }
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
elapsedTime = (int) (System.currentTimeMillis() - startTime);