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

2020/12/16

How do i have multiple levels?

MrSkyPanda MrSkyPanda

2020/12/16

#
So me and my friend are making a game together and we want it so that when our character reaches a certain spot on the map, the world changes into a new level/room. we have no code written rn. How would we do that?
rocket770 rocket770

2020/12/17

#
If you're checking a certain spot you can use it's X and Y Coordinates you can use this in your Character class: If(getX() == xlocation && getY() == ylocation){ Greenfoot.setWorld(new WorldNameHere()); } Where xlocation and ylocation are the coordinates of the spot you want to change the world. Alternatively, you can use an object that will change the world on collision. In your character class you add this line of code: If(isTouching(ObjectCLassName.class)){ Greenfoot.setWorld(new WorldNameHere()); }
You need to login to post a reply.