Why does it say 'invalid method declaration; return type required' in line 17.
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Level_quatre here. * * @author (your name) * @version (a version number or a date) */ public class Level_quatre extends World { HealthBar healthbar = new HealthBar(); private int time; /** * Constructor for objects of class Level_quatre. * */ public Play() { // Create a new world with 600x400 cells with a cell size of 1x1 pixels. super ( 1000 , 700 , 1 ); time = 6000 ; point = 0 ; prepare(); } private void act() { time--; showTime(); } private void showTime() { showText( "Time: " + time/ 100 , 50 , 50 ); } public HealthBar getHealthBar() { return healthbar; } /** * Prepare the world for the start of the program. * That is: create the initial objects and add them to the world. */ private void prepare() { addObject(healthbar, 500 , 40 ); SharkSpawner shark_spawner = new SharkSpawner(); addObject(shark_spawner, 745 , 479 ); shark_spawner.setLocation( 927 , 629 ); Fishes fishes = new Fishes(); addObject(fishes, 810 , 159 ); house house2 = new house(); addObject(house2, 68 , 67 ); house2.setLocation( 26 , 27 ); } } |