1 | addObject( new Actor() { { setImage( new GreenfootImage( "Final Score\n" +finalScore, 64 , null , null )); } }, getWidth()/ 2 , getHeight()/ 2 ); |


1 | addObject( new Actor() { { setImage( new GreenfootImage( "Final Score\n" +finalScore, 64 , null , null )); } }, getWidth()/ 2 , getHeight()/ 2 ); |
1 | public GameOver( int finalScore, int time) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 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, 20 , Color.BLUE, Color.WHITE)); } public void addScore() { score++; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Counter counter = new Counter(); /** * Constructor for objects of class Level1. * */ public Level1() { super ( 600 , 400 , 1 ); prepare(); //Names and Locations of all the Actors in Level1 } public Counter getCounter() { return counter; } |
1 | addObject( new Actor() { { setImage( new GreenfootImage( "Final Score: " +finalScore\n\nTime: "+time, 64 , null , null )); } }, getWidth()/ 2 , getHeight()/ 2 ); |