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

2018/4/1

Changing worlds

1
2
3
4
Lavenger Lavenger

2018/4/1

#
If I were to create a world dedicated for a minigame inside of a game that is in the main game world, would the main game world still be running if I switch over to the world dedicated to the minigame? if it doesn't, can I make it so that it does?
danpost danpost

2018/4/1

#
Lavenger wrote...
If I were to create a world dedicated for a minigame inside of a game that is in the main game world, would the main game world still be running if I switch over to the world dedicated to the minigame? if it doesn't, can I make it so that it does?
Only one world can run at one time. However, it is possible to simulate a running world within another world. See my PIP Actor Class scenario.
Lavenger Lavenger

2018/4/1

#
danpost wrote...
Lavenger wrote...
If I were to create a world dedicated for a minigame inside of a game that is in the main game world, would the main game world still be running if I switch over to the world dedicated to the minigame? if it doesn't, can I make it so that it does?
Only one world can run at one time. However, it is possible to simulate a running world within another world. See my PIP Actor Class scenario.
That's exactly what i'm looking for!! <3 I'm going to read and study the code in that scenario and I'll get back to you on this discussion if i have any other questions on how to do it
Lavenger Lavenger

2018/4/1

#
danpost wrote...
Lavenger wrote...
If I were to create a world dedicated for a minigame inside of a game that is in the main game world, would the main game world still be running if I switch over to the world dedicated to the minigame? if it doesn't, can I make it so that it does?
Only one world can run at one time. However, it is possible to simulate a running world within another world. See my PIP Actor Class scenario.
What exactly is a PIP?
Vercility Vercility

2018/4/1

#
It's literally the first thing u see when clicking the link, picture-in-picture
Lavenger Lavenger

2018/4/1

#
Vercility wrote...
It's literally the first thing u see when clicking the link, picture-in-picture
oh i didnt see that first line hahahaha
Lavenger Lavenger

2018/4/1

#
Is the code
        Class[] order2 = { <<Actors>> };
in
        World space = new Space();
        Class[] order2 = { <<Actors>> };
        pip2 = new PIP(space, order2);
        addObject(pip2, 690, 110);
supposed to list all of the actors used in the world?
danpost danpost

2018/4/1

#
Lavenger wrote...
Is the code
        Class[] order2 = { <<Actors>> };
supposed to list all of the actors used in the world?
Not necessarily. It lists, in order, the classes whose instances you want to be in front of others -- the paint order you want to set for the PIP "world".
Lavenger Lavenger

2018/4/1

#
danpost wrote...
Lavenger wrote...
Is the code
        Class[] order2 = { <<Actors>> };
supposed to list all of the actors used in the world?
Not necessarily. It lists, in order, the classes whose instances you want to be in front of others -- the paint order you want to set for the PIP "world".
so logically speaking, if i did this:
        Class[] order2 = { Rock.class, Ship.class};
and if the rocks intersects with the ship, the rock would be seen over the ship right? also, is it necessary for that code to be coded down in order for the game to work?
danpost danpost

2018/4/1

#
Lavenger wrote...
Class order2 = { Rock.class, Ship.class}; and if the rocks intersects with the ship, the rock would be seen over the ship right?
Correct.
is it necessary for that code to be coded down in order for the game to work?
It is necessary to provide a list for the paint order using the PIP class; however, it can be an empty list.
Lavenger Lavenger

2018/4/1

#
danpost wrote...
Lavenger wrote...
Class order2 = { Rock.class, Ship.class}; and if the rocks intersects with the ship, the rock would be seen over the ship right?
Correct.
is it necessary for that code to be coded down in order for the game to work?
It is necessary to provide a list for the paint order using the PIP class; however, it can be an empty list.
oh i see, i think i get the PIP logic now, thanks for teaching me ^^
Lavenger Lavenger

2018/4/4

#
how do i remove a PIP after adding one into the mainworld?
danpost danpost

2018/4/4

#
Lavenger wrote...
how do i remove a PIP after adding one into the mainworld?
Use removeObject.
Lavenger Lavenger

2018/4/5

#
danpost wrote...
Lavenger wrote...
how do i remove a PIP after adding one into the mainworld?
Use removeObject.
when I remove the PIP, do I remove PIP as a whole or pip1, I plan to using the pip actor again after removing it
danpost danpost

2018/4/5

#
Lavenger wrote...
when I remove the PIP, do I remove PIP as a whole or pip1, I plan to using the pip actor again after removing it
You can remove all PIP actors with removeObjects(getObjects(PIP.class)) or remove a specific one with removeObject(pip1). It is up to you. If you want to add the same PIP actor back into the world, you will need a field to maintain a reference to the object. Otherwise, you can just add new PIP actor into the world.
There are more replies on the next page.
1
2
3
4