I have made a game, and want it to become fullscreen, so I used Gevater_Tod4711's fullscreen rewriter to turn my game to fullscreen.
I did this successfully, but the worlds needed to be abstract for it to work, so I turned them all into abstract classes. But now, because abstract worlds cannot be instantiated (that is what the error in my code says), I cannot get the game to compile and be able to play it in fullscreen! Any help?
Code for Button that creates the map and sends you to it:
Code for the actual world it sends you to:
Link to the fullscreen thing i used: Fullscreen Rewriter
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Map1BTN here. * * @author (your name) * @version (a version number or a date) */ public class Map1BTN extends Actor { /** * Act - do whatever the Map1BTN wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { if (FullScreenWindow.mouseClicked( this )){ Map1 startscreen = new Map1(); Greenfoot.setWorld(startscreen); } } } |
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 | import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Map1 here. * * @author (your name) * @version (a version number or a date) */ public abstract class Map1 extends FullScreenWorld { /** * Constructor for objects of class Map1. * */ public Map1() { // Create a new world with 600x400 cells with a cell size of 1x1 pixels. super ( 1000 , 700 , 1 , true ); 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() { Player1 player1 = new Player1(); addObject(player1, 117 , 579 ); Player2 player2 = new Player2(); addObject(player2, 883 , 561 ); } } |