This site requires JavaScript, please enable it in your browser!
Greenfoot back
SophieMarie777
SophieMarie777 wrote ...

2012/12/22

How to add a counter?

SophieMarie777 SophieMarie777

2012/12/22

#
I want to add a counter to see how much points you're given. Every time I try to code one, though, it says it's wrong. How do you add a counter??
ManiacalPenguin ManiacalPenguin

2012/12/22

#
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) import java.awt.Color; // DONT FORGET THIS PART public class Score extends Texts { public void act() { setImage(new GreenfootImage("Score: " + Character.score, 20, Color.white, new Color(0,0,0,0))); } }
ManiacalPenguin ManiacalPenguin

2012/12/22

#
and dont forget to add the class Score to your world
SophieMarie777 SophieMarie777

2012/12/22

#
Yay! Thank you, Penguin-man!
You need to login to post a reply.