I'm not really sure what that means. I'm trying to create a scrolling world but I get this error message when I try to compile. The codes used are as follows.
That code is in my world code and I have two actors one is the platforms that will be in my world and the second is the map of the world. The actor with the world map has no code in it and the platforms code is just this.
I'm not sure what the problems is it keeps pointing to this code when it gives the error.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) import java.awt.Color; import java.util.List; import java.util.ArrayList; public class Sky extends World { PlatformMap map = new PlatformMap(); GreenfootImage mapImg = map.getImage(); final int MAPINGWIDTH = mapImg.getWidth(); final int MAPINGHEIGHT = mapImg.getHeight(); Platform platformTemplate = new Platform(0,0); GreenfootImage pfImg = platformTemplate.getImage(); final int PLATFORMHEIGHT = pfImg.getHeight(); final int PLATFORMWIDTH = pfImg.getWidth(); final int MAPWIDTH = MAPINGWIDTH * PLATFORMWIDTH; final int MAPHEIGHT = MAPINGHEIGHT * PLATFORMHEIGHT; private List<Platform> thePlatforms = new ArrayList<Platform>(); int leftBound = 0; int bottomBound = MAPHEIGHT; int topBound = MAPHEIGHT - getHeight(); int rightBound = getWidth(); public Sky() { super(1000, 800, 1); makeMap(); update(); } public void makeMap() { for(int y=0; y<MAPHEIGHT; y++) { for(int x=0; x<MAPWIDTH; x++) { int colorRGB = mapImg.getColorAt(x,y).getRGB(); if(colorRGB == Color.BLACK.getRGB()) { int mapX = x * PLATFORMWIDTH + PLATFORMWIDTH/2; int mapY = y * PLATFORMHEIGHT + PLATFORMHEIGHT/2; thePlatforms.add(new Platform(mapX, mapY)); } } } } public void update() { Platform thisPlatform; int thisPlatformX; int thisPlatformY; int screenX; int screenY; for(int i = 0; i<thePlatforms.size(); i++) { thisPlatform = thePlatforms.get(i); thisPlatformX = thisPlatform.mapX; thisPlatformY = thisPlatform.mapY; if(thisPlatformX >= leftBound && thisPlatformX <= rightBound && thisPlatformY >= topBound && thisPlatformY <= bottomBound) { screenX = thisPlatformX - leftBound; screenY = thisPlatformY - topBound; if(thisPlatform.getWorld() == null) { addObject(thisPlatform, screenX, screenY); } } } } }
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) public class Platform extends Actor { int mapX; int mapY; public Platform(int getMapX, int getMapY) { mapX = getMapX; mapY = getMapY; } }
int colorRGB = mapImg.getColorAt(x,y).getRGB();