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

2020/9/14

How to create levels of a game?

ShauryaThapan ShauryaThapan

2020/9/14

#
Hi, I was creating a shooting game. Now I want create few levels
RcCookie RcCookie

2020/9/14

#
I obviously don’t exactly know how your game works, but one relatively convenient way of doing this in Greenfoot(there is no real „good“ way I don’t think) is to make one abstract class named for example „level“ which contains all the core functionality of any level. Then for each individual level you create a new subclass and name it like „level1“. Then you can go ahead and use drag and drop to create a layout and use „Save World“ to create the code for that automatically.
danpost danpost

2020/9/14

#
Oftentimes, the inclusion of static fields (class variables) in your MyWorld class is sufficient to allow the game to become more difficult from one world instance to the next. Some static final fields (class constants) can be used to describe the initial set-up of a "level". One static field (variable) would be used to track which level is current.
You need to login to post a reply.