Hey, i would like to display a text box with instructions of how to play a game that i am making. This text box should appear when the 'm' key is being pressed down the remove when the key is let go of.
Following is the code in my world class and then the code of my instructionsPage class:
instructionsPage instructionsPage = new instructionsPage();
if ("m".equals(Greenfoot.getKey()))
{
addObject(instructionsPage,350,150);
removeObject(instructionsPage);
}public class instructionsPage extends Actor
{
String text = "-The objective of the game is to capture more pebbles in the mancala than the opposing player\n"+
"-Fill each of the 12 dips up with 4 pebbles in each (leave the mancalas empty)\n"+
"-Player one picks up all the pebbles in a chosen dip (of which there are six to choose from), they then put one pebble in each hole going anticlockwise around the board.\n"+
"-If you run into your own mancala you deposit a pebble, if you run into the opponent’s mancala you skip it\n"+
"-If the last pebble distributed lands on their mancala then player one has another turn\n"+
"-If the last pebble distributed from a dip lands in a dip with no pebbles in it, then the player picks up that single pebble and all the opponents pebbles in the adjacent dip.\n"+
"-The game is complete when one of the players has no pebbles left in their 6 dips, when this happens the remaining pebbles in the dips of the second player are put into their mancala. The pebbles of each Mancala are added up (usually this would be done by the players, but mine will be automated) and the player with the most pebbles wins.\n";
public void act()
{
setImage(new GreenfootImage(text, 15, Color.BLACK, Color.WHITE));
}
}

