This site requires JavaScript, please enable it in your browser!
Greenfoot back
GUARDIAN-X

GUARDIAN-X

Central Nine, Franklin

GUARDIAN-X's collections

space games

Recent Comments | Show All

GUARDIAN-X

2014/10/24

import greenfoot.*; import java.awt.Color; public class Counter extends Actor { private int totalCount = 0; public Counter() { setImage(new GreenfootImage("Score: 0", 50, Color.WHITE, Color.BLACK)); } public void bumpSet(int amount) { totalCount = amount; setImage(new GreenfootImage("Score: " + totalCount, 50, Color.WHITE, Color.BLACK)); } public void bumpCount(int amount) { totalCount += amount; setImage(new GreenfootImage("" + totalCount, 50, Color.WHITE, Color.BLACK)); } }
GUARDIAN-X

2014/10/24

that isn't the right code, give me a moment...