Hi There,
W're under pressure to finish a side scrolling game for college.
I'm working on a world that randomly builds itself as the player is playing.
I've got a good plan, but I'm having trouble getting access to methods that are contained within a list, here's my code:
I had the code within the for loop on one line, and was getting the error saying it couldn't find the method activateType, so I moved that section to the next row and replaced it with the int 3 for testing purposes, then I get the error "cannot find the method setImage()".
This class extends Actor so it has setImage() and I wrote activateType() myself so that's there too, there's another method called getType() which it also says isn't there.
Any ideas?
public SpaceWorld() { super(1100, 600, 1, false); currentBackground.drawImage(backgroundWorld, 0, 0); setBackground(currentBackground); addObject(new SpaceShip (), 70, 150); int x = 0; addObject(new Block(), 200,200); addObject(new Block(), 200,222); List blockList = getObjects(Block.class); System.out.println("blocklist size = " + blockList.size()); // print the size of the list to the terminal for(int b= 0; b < blockList.size(); b++){ blockList.get(b).setImage(spriteFactory.getBlock(3)); blockList.get(b).activateType(); }