gt: 				for(MenuItem item : menuItems){
context: /* 
   * Copyright 2012 Bryan Wyatt
   * 
   * This file is part of BadScience!.
   *  
   * BadScience! is free software: you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation, either version 3 of the License, or
   * (at your option) any later version.
   * 
   * BadScience! is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   * 
   * You should have received a copy of the GNU General Public License
   * along with BadScience!.  If not, see <http://www.gnu.org/licenses/>.
   */
  
  package com.junglecatsoftware.badscience.levels.levels;
  
  import java.awt.Color;
  import java.awt.event.KeyEvent;
  import java.util.ArrayList;
  import java.util.Random;
  
  import com.junglecatsoftware.badscience.drawables.FloorTile;
  import com.junglecatsoftware.badscience.drawables.GridOverlay;
  import com.junglecatsoftware.badscience.drawables.PauseMenuOverlayBackground;
  import com.junglecatsoftware.badscience.drawables.Player;
  import com.junglecatsoftware.badscience.drawables.WallTile;
  import com.junglecatsoftware.brge.BRGE;
  import com.junglecatsoftware.brge.Game;
  import com.junglecatsoftware.brge.graphics.ScreenObjects;
  import com.junglecatsoftware.brge.graphics.drawables.BlackBackground;
  import com.junglecatsoftware.brge.graphics.drawables.Drawable;
  import com.junglecatsoftware.brge.graphics.drawables.LevelGridDrawable;
  import com.junglecatsoftware.brge.graphics.drawables.MenuItem;
  import com.junglecatsoftware.brge.levelgrid.LevelGrid;
  import com.junglecatsoftware.brge.levelgrid.LevelGridSquare;
  import com.junglecatsoftware.brge.levels.Level;
  
  
  
  public class TestLevel extends Level{
  	
  	private boolean run=true;
  	private boolean pause=false;
  	private Thread t;
  	private GridOverlay overlay;
  	private Player player;
  	private boolean showOverlay;
  	private boolean startShiftLeft;
  	private boolean startShiftRight;
  	private boolean startShiftUp;
  	private boolean startShiftDown;
  	private boolean shiftingLeft;
  	private boolean shiftingRight;
  	private boolean shiftingUp;
  	private boolean shiftingDown;
  	
  	private LevelGrid levelGrid;
  	private LevelGridSquare centerGridSquare;
  
  	//stuff for the menu
  	private ArrayList<MenuItem> menuItems;
  	private int selectedMenuItem=0;
  	private boolean menuSelected=false; //Ensure that menu items can't be triggered if the spacebar was pressed prior to the menu loading
  	
  	public TestLevel(Game g, ScreenObjects so){
  		super(g, so);
  		levelGrid=new LevelGrid(BRGE.getWidth(),BRGE.getHeight());
  	}
  	public TestLevel(Game g, ScreenObjects so, LevelGrid lg){
  		super(g, so);
  		levelGrid=lg;
  	}
  
  	public void startLevel() {
  		screenObjects.clear();
  		levelGrid.resetGrid();
  
  		screenObjects.addToBottom(new BlackBackground());
  		
  		for(int y=0;y<levelGrid.getGridHeight();y+=1){
  			for(int x=0;x<levelGrid.getGridWidth();x+=1){
  				LevelGridSquare square=levelGrid.getGridSquare(x, y);
  				loadTile(square);
  			}
  		}
  		
  		screenObjects.addToTop(levelGrid);
  		centerGridSquare=levelGrid.getGridSquare((levelGrid.getGridWidth()-1)/2,(levelGrid.getGridHeight())/2);
  		player=new Player(centerGridSquare.copy(), Color.BLACK);
  		levelGrid.setPlayerDrawable(player);
  		
  		overlay=new GridOverlay(levelGrid);
  		showOverlay=false;
  		//screenObjects.addToTop(overlay);
  
  		t=new Thread(){ public void run(){ runGame(); }};
  		t.start();
  	}
  	public void endLevel() {
  		run=false;
  		pause=false;
  		while(t.isAlive()){
  			wait(1);
  		}
  		screenObjects.clear();
  		levelGrid.resetGrid();
  		
  		shiftingLeft=false;
  		shiftingRight=false;
  		shiftingUp=false;
  		shiftingDown=false;
  	}
  	public void keyPressed(int key) {
  		switch(key){
  			case KeyEvent.VK_LEFT:
  				startShiftRight=true;
  				break;
  			case KeyEvent.VK_RIGHT:
  				startShiftLeft=true;
  				break;
  			case KeyEvent.VK_UP:
  				if(pause){
  					menuUp();
  				}
  				startShiftDown=true;
  				break;
  			case KeyEvent.VK_DOWN:
  				if(pause){
  					menuDown();
  				}
  				startShiftUp=true;
  				break;
  			case KeyEvent.VK_SPACE:
  				if(pause){
  					menuSelected=true;
  				}
  				break;
  			case KeyEvent.VK_ENTER:
  				if(pause){
  					menuSelected=true;
  				}
  				break;
  		}
  	}
  	public void keyReleased(int key) {
  		switch(key){
  			case KeyEvent.VK_LEFT:
  				startShiftRight=false;
  				break;
  			case KeyEvent.VK_RIGHT:
  				startShiftLeft=false;
  				break;
  			case KeyEvent.VK_UP:
  				startShiftDown=false;
  				break;
  			case KeyEvent.VK_DOWN:
  				startShiftUp=false;
  				break;
  			case KeyEvent.VK_SPACE:
  				if(pause){
  					if(menuSelected){
  						menuSelected=false;
  						menuActivated();
  					}
  				}
  				break;
  			case KeyEvent.VK_ESCAPE:
  				if(pause){
  					menuSelected=false;
  					pause=false;
  				}else{
  					pause=true;
  				}
  				break;
  			case KeyEvent.VK_ENTER:
  				if(pause){
  					if(menuSelected){
  						menuSelected=false;
  						menuActivated();
  					}
  				}
  				break;
  			case KeyEvent.VK_G:
  				if(!pause){
  					if(showOverlay){
  						showOverlay=false;
  						screenObjects.remove(overlay);
  					}else{
  						showOverlay=true;
  						screenObjects.addToTop(overlay);
  					}
  				}
  				break;
  		}
  	}
  	public void keyTyped(int key) {
  		switch(key){
  		}
  	}
  	
  	private void runGame(){
  		run=true;
  		int counter=1; //tick-tock counter
  		while(run){
  			
  			if(pause){//if game has been paused
  				//create and display menu
  				PauseMenuOverlayBackground bg=new PauseMenuOverlayBackground();
  				screenObjects.addToTop(bg);
  				
  				menuItems=new ArrayList<MenuItem>();
  				menuItems.add(new MenuItem(1, "Toggle DrawFPS"));
  				menuItems.add(new MenuItem(2, "Draw Shadows ("+BRGE.getDrawShadows()+")"));
  				menuItems.add(new MenuItem(4, true, "Exit to Main Menu"));
  