public SpaceGreen() { super(WIDTH, HEIGHT, CELL); Brain2.checkCount(); Background(); fillStars(sTars, MAX_STAR); Setstars(); GreenfootImage earthp = new GreenfootImage("Images/HalfEarth.png"); getBackground().drawImage(earthp, earth.getX(), earth.getY()); GreenfootImage moonp = new GreenfootImage("Images/Moon.png"); getBackground().drawImage(moonp, moon.getX(), moon.getY()); GreenfootImage saturnp = new GreenfootImage("Images/Saturn.png"); getBackground().drawImage(saturnp, saturn.getX(), saturn.getY()); GreenfootImage marsp = new GreenfootImage("Images/RedPlanet.png"); getBackground().drawImage(marsp, mars.getX(), mars.getY()); ship = new Spaceship(); mothership = new Mothership(); explosion = new Explosion(); addObject(mothership, mothership.getX(mothership.x), mothership.getY(mothership.y)); addObject(ship, ship.getX(), ship.getY(ship.y)); Checkstars(); Checkplanets(); }
public void Checkstars() { if (isTopLeft(moon.getX(), moon.getY()) || isTopLeft(mars.getX(), mars.getY()) || isTopLeft(saturn.getX(), saturn.getY())) { topleft = true; } if (isTopRight(moon.getX(), moon.getY()) || isTopRight(saturn.getX(), saturn.getY()) || isTopRight(mars.getX(), mars.getY())) { topright = true; } if (isBottomLeft(moon.getX(), moon.getY()) || isBottomLeft(saturn.getX(), saturn.getY()) || isBottomLeft(mars.getX(), mars.getY())) { bottomleft = true; } if (isBottomRight(moon.getX(), moon.getY()) || isBottomRight(saturn.getX(), saturn.getY()) || isBottomRight(mars.getX(), mars.getY())) { bottomright = true; } }