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

2016/11/11

False in super

gmacias gmacias

2016/11/11

#
Would someone please explain the 'false' parameter in this case. Thank you
public class MyWorld extends World
{
    
    /**
     * Constructor for objects of class MyWorld.
     * 
     */
    public MyWorld()
    {    
        // Create a new world with 600x300 cells with a cell size of 1x1 pixels.
        super(600, 300, 1, false); 
    }
}
danpost danpost

2016/11/11

#
gmacias wrote...
Would someone please explain the 'false' parameter in this case. < Code Omitted >]
See here..
gmacias gmacias

2016/11/11

#
Makes perfect sense! Thank you :)
DawsTheBaws DawsTheBaws

2016/11/11

#
I think it represents whether or not there are boundaries on the world. true = boundaries false = no boundaries In this case there are no boundaries and your actors can travel out of the world (off the screen). Correct me if I'm wrong people.
gmacias gmacias

2016/11/11

#
so if i typed 'true' would it be the same thing as leaving out the parameter altogether?
gmacias gmacias

2016/11/11

#
or would typing 'true' mean that some space exists beyond the size of the world and coordinates are limited to the background size?
danpost danpost

2016/11/12

#
gmacias wrote...
so if i typed 'true' would it be the same thing as leaving out the parameter altogether?
Exactly right. Actors will be limited to (0, 0)-(getWorld().getWidth()-1, getWorld().getHeight()-1). The only space that might seem to exist is where half the image of an actor is "hidden" beyond the edge
You need to login to post a reply.