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

2017/1/9

Levels

jacquelinereilly jacquelinereilly

2017/1/9

#
i am making a game, and have a select level screen. I can't figure out how to get the user to select 1 ,because it is a picture ,I didn't do individual buttons, should I? It can't be too complicated, it is a school project
jacquelinereilly jacquelinereilly

2017/1/9

#
there aren't a lot of levels, 2 or 3 max. But I feel adding individual buttons will be a lot of code
AuroraGamer AuroraGamer

2017/1/9

#
Adding buttons shouldn't be too bad, if there's only 2 or 3 levels, just make three different subclasses of actor (one for each level) then in each of those put,
public class ButtonOne extends Actor
{
public void act()
{
if (Greenfoot.mouseClicked(this))
{
Greenfoot.setWorld(new LevelOne());
}
}
(replacing 'LevelOne' with the name of the world, and 'ButtonOne' with the name of the class)
jacquelinereilly jacquelinereilly

2017/1/9

#
thank you!
You need to login to post a reply.