hello how do i create a scoreboard??


1 2 3 4 5 6 7 8 | private int killCount = 0 ; //in act if (isTouching(ClassToRemove. class )) { removeTouching(ClassToRemove. class ); killCount++; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | public class A extends Actor { public A() { //this is to resize the image GreenfootImage image = getImage(); image.scale( 330 , 150 ); } public void act() { setLocation (getX(), getY()+ 6 ); private int killCount = 0 ; //in act if (isTouching(ClassToRemove. class )) { removeTouching(ClassToRemove. class ); killCount++; } if (Greenfoot.isKeyDown( "a" )) { getWorld().removeObject( this ); // removing A actor on 'a' press Greenfoot.playSound( "poppy.wav" ); // playing 'pop' when A actor is removed } else if (getY() == getWorld().getHeight()- 1 ) { ((bg)getWorld()).gameOver(); return ; } } } |
1 | public A(); private int killCount = 0 ; |