This site requires JavaScript, please enable it in your browser!
Greenfoot back
ArchMageGaming
ArchMageGaming wrote ...

2017/1/14

Issues with Fullscreen and creating worlds.

ArchMageGaming ArchMageGaming

2017/1/14

#
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:
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);
        }
    }   
}
Code for the actual world it sends you to:
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);
    }
}
Link to the fullscreen thing i used: Fullscreen Rewriter
danpost danpost

2017/1/14

#
I tried a copy of a scenario with it. I had no keyboard or mouse controls that previously worked with the scenario and had no file or desktop controls to work with -- could only break out of full screen by calling task manager.
ArchMageGaming wrote...
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!
I do not see why you would have to make your World subclasses abstract. In fact, I do not think you are supposed to change your code once you convert the project to full screen (you work on the standard greenfoot scenario, then convert it). At least, that is the way I would think it is supposed to work. Anyway, if your World subclasses were supposed to be abstract, the FullScreenRewriter should change that for you, too.
ArchMageGaming ArchMageGaming

2017/1/14

#
Oh nvm! I fiddled around with some stuff and got it to work! Thanks for the help!
danpost danpost

2017/1/14

#
ArchMageGaming wrote...
I fiddled around with some stuff and got it to work
What did you do? -- others might want to know.
Nosson1459 Nosson1459

2017/1/15

#
danpost wrote...
I tried a copy of a scenario with it. I had no keyboard or mouse controls that previously worked with the scenario and had no file or desktop controls to work with -- could only break out of full screen by calling task manager.
I tried it and everything PRETTY MUCH worked, they just weren't as accurate. As for breaking out of full screen Gevater_Tod4711 said to use Alt + Tab, but that's also a window key shortcut and doesn't actually close the window rather it switches it to the regular Greenfoot window with the full screen window minimized. (The shortcut is used for switching the front window, by pressing the keys once without holding down on Alt, it will switch to the second to latest window which is the Greenfoot one which was just opened.)
danpost wrote...
ArchMageGaming wrote...
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!
I do not see why you would have to make your World subclasses abstract. In fact, I do not think you are supposed to change your code once you convert the project to full screen (you work on the standard greenfoot scenario, then convert it). At least, that is the way I would think it is supposed to work. Anyway, if your World subclasses were supposed to be abstract, the FullScreenRewriter should change that for you, too.
In the beginning changes needed to be made to the scenario after conversion, but now with all the updates no changes should need to be made to your scenario once you convert it because they happen automatically (that's the way it was by me).
danpost wrote...
ArchMageGaming wrote...
I fiddled around with some stuff and got it to work
What did you do? -- others might want to know.
You need to login to post a reply.