Whats going on what do i need to change to make it better??
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Main player. Gets controlled by user. * * @author (Quinn Sapp) * @version (5 July 2013) */ public class MainPlayer extends Animal { private Label myLabel; private int count; public MainPlayer(Label label) { myLabel = label; } public void act() { checkKeyPress(); lookForPoint(); checkNextLevel(); checkNextLevel2(); checkNextLevel3(); checkNextLevel4(); checkNextLevel5(); }// end act public void checkKeyPress(){ if (Greenfoot.isKeyDown("left")){ turn(-4); } if (Greenfoot.isKeyDown("right")){ turn(4); } if (Greenfoot.isKeyDown("up")){ turn(4); } if (Greenfoot.isKeyDown("down")){ turn(4); } if (Greenfoot.isKeyDown("space")){ move(2); } }//end checkKeys public void lookForPoint(){ if (canSee(Point.class)){ eat(Point.class); Greenfoot.playSound("au.wav"); count++; myLabel.setText("Count: " + count); } } //end lookForPoint public void checkNextLevel(){ if (getOneIntersectingObject(Finish.class) != null) { //reached the end object; //start the new level; Greenfoot.setWorld(new Level2()); } }//end MainPlayer Class public void checkNextLevel2(){ if (getOneIntersectingObject(Finish2.class) != null) { //reached the end object; //start the new level; Greenfoot.setWorld(new Level3()); } } public void checkNextLevel3(){ if (getOneIntersectingObject(Finish3.class) != null) { //reached the end object; //start the new level; Greenfoot.setWorld(new Level4()); } } public void checkNextLevel4(){ if (getOneIntersectingObject(Finish4.class) != null) { //reached the end object; //start the new level; Greenfoot.setWorld(new Level5()); } } public void checkNextLevel5(){ if (getOneIntersectingObject(Finish5.class) != null) { //reached the end object; //start the new level; Greenfoot.setWorld(new WINNER()); } } }
//MainWorld import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Level2 here. * * @author (your name) * @version (a version number or a date) */ public class MainWorld extends World { /** * Constructor for objects of class MainWorld. * */ public MainWorld() { // Create a new world with 600x400 cells with a cell size of 1x1 pixels. super(600, 400, 1); prepare(); } /** * Prepare the world for the start of the program. That is: create the initial * objects and add them to the world. */ private void prepare() { Start start = new Start(); addObject(start, 31, 70); Start start2 = new Start(); addObject(start2, 33, 212); Start start3 = new Start(); addObject(start3, 31, 348); start.setLocation(25, 67); start2.setLocation(25, 213); start3.setLocation(25, 347); Border border = new Border(); addObject(border, 92, 83); Border border2 = new Border(); addObject(border2, 82, 229); Border border3 = new Border(); addObject(border3, 81, 344); start.setLocation(25, 64); border.setLocation(100, 64); border2.setLocation(100, 207); start3.setLocation(25, 348); border3.setLocation(100, 347); Finish finish = new Finish(); addObject(finish, 559, 59); Finish finish2 = new Finish(); addObject(finish2, 557, 207); Finish finish3 = new Finish(); addObject(finish3, 559, 355); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(559, 59); finish.setLocation(592, 50); finish.setLocation(592, 50); finish.setLocation(592, 50); finish.setLocation(592, 50); finish.setLocation(592, 50); finish.setLocation(592, 50); finish.setLocation(592, 50); finish.setLocation(592, 50); finish.setLocation(592, 50); finish.setLocation(592, 50); finish.setLocation(592, 50); finish.setLocation(592, 50); finish.setLocation(592, 50); finish.setLocation(592, 50); finish.setLocation(592, 50); finish.setLocation(592, 50); finish.setLocation(592, 50); finish.setLocation(592, 50); finish.setLocation(575, 70); finish2.setLocation(575, 208); finish3.setLocation(559, 355); finish3.setLocation(574, 344); finish3.setLocation(575, 334); Border border4 = new Border(); addObject(border4, 475, 85); Border border5 = new Border(); addObject(border5, 464, 175); Border border6 = new Border(); addObject(border6, 480, 305); border4.setLocation(501, 72); border5.setLocation(501, 218); border6.setLocation(501, 358); Enemy2 enemy2 = new Enemy2(); addObject(enemy2, 169, 34); Enemy2 enemy22 = new Enemy2(); addObject(enemy22, 178, 87); Enemy2 enemy23 = new Enemy2(); addObject(enemy23, 224, 189); Enemy2 enemy24 = new Enemy2(); addObject(enemy24, 160, 264); Enemy2 enemy25 = new Enemy2(); addObject(enemy25, 170, 172); Enemy2 enemy26 = new Enemy2(); addObject(enemy26, 282, 123); Enemy2 enemy27 = new Enemy2(); addObject(enemy27, 250, 10); Enemy2 enemy28 = new Enemy2(); addObject(enemy28, 261, 78); Enemy2 enemy29 = new Enemy2(); addObject(enemy29, 383, 34); Enemy2 enemy210 = new Enemy2(); addObject(enemy210, 437, 79); Enemy2 enemy211 = new Enemy2(); addObject(enemy211, 383, 158); Enemy2 enemy212 = new Enemy2(); addObject(enemy212, 364, 102); Enemy2 enemy213 = new Enemy2(); addObject(enemy213, 322, 200); Enemy2 enemy214 = new Enemy2(); addObject(enemy214, 243, 148); Enemy2 enemy215 = new Enemy2(); addObject(enemy215, 249, 354); Enemy2 enemy216 = new Enemy2(); addObject(enemy216, 255, 285); Enemy2 enemy217 = new Enemy2(); addObject(enemy217, 208, 343); Enemy2 enemy218 = new Enemy2(); addObject(enemy218, 231, 245); Enemy2 enemy219 = new Enemy2(); addObject(enemy219, 293, 235); Enemy2 enemy220 = new Enemy2(); addObject(enemy220, 392, 344); Enemy2 enemy221 = new Enemy2(); addObject(enemy221, 414, 255); Enemy2 enemy222 = new Enemy2(); addObject(enemy222, 348, 297); Enemy2 enemy223 = new Enemy2(); addObject(enemy223, 368, 227); Enemy2 enemy224 = new Enemy2(); addObject(enemy224, 434, 201); Enemy2 enemy225 = new Enemy2(); addObject(enemy225, 459, 117); Enemy2 enemy226 = new Enemy2(); addObject(enemy226, 491, 196); Enemy2 enemy227 = new Enemy2(); addObject(enemy227, 475, 355); Enemy2 enemy228 = new Enemy2(); addObject(enemy228, 336, 371); Enemy2 enemy229 = new Enemy2(); addObject(enemy229, 180, 383); Enemy2 enemy230 = new Enemy2(); addObject(enemy230, 154, 326); Enemy2 enemy231 = new Enemy2(); addObject(enemy231, 135, 148); Enemy2 enemy232 = new Enemy2(); addObject(enemy232, 341, 31); Enemy2 enemy233 = new Enemy2(); addObject(enemy233, 478, 43); Label label = new Label ("Count: 0"); addObject (label, 100, 380); } }