I want to have a start menu for my game. my game is simple maze game with multiple levels, I want to be able to have 3 different buttons on the menu as well as a picture. is this possible?
code for level 1 of game:
and yes i realise that the level 1 is called level2.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class MyWorld here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Level2 extends World
{
private int [] [] mazeMap = {
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,2,1,0,0,1,1,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,1},
{1,0,1,1,0,0,0,0,1,1,0,1,1,1,1,0,1,0,1,0,0,1,1,1},
{1,0,1,1,0,1,1,0,1,1,0,0,0,3,0,4,1,1,1,1,0,1,1,1},
{1,0,1,0,0,0,0,0,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1},
{1,0,1,0,1,1,0,1,1,0,1,0,0,1,1,1,1,1,1,0,4,1,1,1},
{1,0,1,0,0,0,0,1,1,0,1,0,1,1,1,1,1,1,1,0,1,1,1,1},
{1,0,4,3,1,1,5,1,1,0,0,0,0,0,0,1,1,0,0,3,0,0,0,1},
{1,0,1,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,0,1},
{1,0,1,0,0,1,0,1,1,1,0,1,1,1,1,0,1,1,0,1,1,1,0,1},
{1,0,1,1,1,1,0,0,0,1,0,0,0,1,1,5,1,1,5,1,0,0,0,1},
{1,0,1,1,1,1,1,1,0,1,0,1,1,0,1,0,1,1,0,1,0,1,1,1},
{1,0,1,1,1,1,1,0,0,0,3,0,3,0,0,0,1,0,0,0,0,1,1,1},
{1,0,0,3,0,0,0,0,1,1,1,1,1,1,1,0,1,0,1,1,0,0,0,1},
{1,1,4,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,0,6},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
};
/**
* Constructor for objects of class MyWorld.
*
*/
public Level2()
{
super(1200, 800, 1);
placeBlocks();
prepare();
}
public void placeBlocks()
{
for (int i=0; i<mazeMap.length; i++)
{
for (int j=0; j<mazeMap[i].length; j++)
{
if (mazeMap[i][j]==0)
{
}
if (mazeMap[i][j]==1)
{
Wall wall= new Wall();
addObject (wall, j*50 +25, i*50 +25);
}
if (mazeMap[i][j]==2)
{
Player player = new Player();
addObject (player, j*50 +25, i*50 +25);
}
if (mazeMap[i][j]==3)
{
Enemy enemy = new Enemy();
addObject (enemy, j*50 +25, i*50 +25);
}
if (mazeMap[i][j]==4)
{
Collectibles collectibles = new Collectibles();
addObject (collectibles, j*50 +25, i*50 +25);
}
if (mazeMap[i][j]==5)
{
Enemy2 enemy2 = new Enemy2();
addObject (enemy2, j*50 +25, i*50 +25);
}
if (mazeMap[i][j]==6)
{
End end = new End();
addObject (end, j*50 +25, i*50 +25);
}
}
}
}
/**
* Prepare the world for the start of the program.
* That is: create the initial objects and add them to the world.
*/
private void prepare()
{
}
}
