I can't see anything which could create an error at this code, however if I reset the game it just crashes with no error log message or anything usefull for solving the problem.
Codes in which the error could be:
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 Background extends World{ private int imageCount = 0; private GreenfootImage bgImage = new GreenfootImage("Background.png"); public int dif = MMPlayer.diff; public int height = 0; public void act() { imageCount += 4; drawBackgroundImage(); height++; showText("Height:" + height + " / 3000",100,50); if(height >= 2980) { showText ("Level Completed",500,375); } switch (dif) { case 1: PlanetspawnerE(); case 2: PlanetspawnerM(); case 3: PlanetspawnerH(); } }... unnecessary |
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 59 60 61 62 63 64 65 66 | public class MMPlayer extends Actor{ public static int diff; public MMPlayer() { this.getImage().scale(50, 100); setLocation(500,700); } public void act() { setImage("MMRocket.png"); this.getImage().scale(50, 100); if(Greenfoot.isKeyDown("right")) { setImage("Rocket+30.png"); this.getImage().scale(70, 82); move(4); } if(Greenfoot.isKeyDown("left")) { setImage("Rocket-30.png"); this.getImage().scale(70, 82); move(-4); } if(Greenfoot.isKeyDown("up")) { setLocation(getX(), (getY()-4)); } if(Greenfoot.isKeyDown("down")) { setLocation(getX(), (getY()+4)); } Actor Easy = getOneIntersectingObject(MMEasy.class); Actor Medium = getOneIntersectingObject(MMMedium.class); Actor Hard = getOneIntersectingObject(MMHard.class); Actor Hitbox = getOneIntersectingObject(TryAgain.class); if(Easy !=null) { setImage("Explosion.png"); diff = 1; Greenfoot.setWorld(new Background()); } if(Medium !=null) { setImage("Explosion.png"); diff = 2; Greenfoot.setWorld(new Background()); } if(Hard !=null) { setImage("Explosion.png"); diff = 3; Greenfoot.setWorld(new Background()); } if (Hitbox != null) { setImage("Explosion.png"); Greenfoot.setWorld(new Background()); } } } |

