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

2023/4/26

Accessing different Levels from a main Menu:

IronManLXIV IronManLXIV

2023/4/26

#
I am currently working on a PacMan game with a menu and I’ve problems connecting this menu with the levels. I tried doing it with addObject(new level, x, y), however as level is a subclass of World it is not working with addObject(). Is there different command for opening subclasses of World?
danpost danpost

2023/4/26

#
IronManLXIV wrote...
I am currently working on a PacMan game with a menu and I’ve problems connecting this menu with the levels. I tried doing it with addObject(new level, x, y), however as level is a subclass of World it is not working with addObject(). Is there different command for opening subclasses of World?
Use:
Greenfoot.setWorld(level);
to "open" the world. This sets that world, level, as the active world.
IronManLXIV IronManLXIV

2023/4/27

#
Thank you!:)
You need to login to post a reply.