public override void Render(Graphics g2) { //Graphics g2 = Graphics.FromImage(bufferedImage); SolidBrush brush = new SolidBrush(Color.White); Font font = new Font("Verdana", 14); if (g2 != null) { // NOTE: two lines below make the error splash white screen.... // need to remove this line ////g2.setColor(Color.WHITE); //g2.FillRectangle(brush,0, 0, GameFrame.SCREEN_WIDTH, GameFrame.SCREEN_HEIGHT); //physicalMap.draw(g2); switch (state) { case GameState.INIT_GAME: brush.Color = Color.Black; g2.FillRectangle(brush, 0, 0, GameFrame.SCREEN_WIDTH, GameFrame.SCREEN_HEIGHT); brush.Color = Color.White; g2.DrawString("PRESS ENTER TO CONTINUE", font, brush, 400, 300); break; case GameState.PAUSEGAME: brush.Color = Color.Black; g2.FillRectangle(brush, 300, 260, 500, 70); brush.Color = Color.White; g2.DrawString("PRESS ENTER TO CONTINUE", font, brush, 400, 300); break; case GameState.TUTORIAL: backgroundMap.draw(g2); if (tutorialState == TutorialState.MEETreadonlyBOSS) { particularObjectManager.draw(g2, gameTime); } TutorialRender(g2); break; case GameState.GAMEWIN: case GameState.GAMEPLAY: backgroundMap.draw(g2); particularObjectManager.draw(g2, gameTime); bulletManager.draw(g2, gameTime); brush.Color = Color.Gray; g2.FillRectangle(brush, 19, 59, 102, 22); brush.Color = Color.Red; g2.FillRectangle(brush, 20, 60, megaMan.getBlood(), 20); for (int i = 0; i < numberOfLife; i++) { g2.DrawImage(CacheDataLoader.getInstance().getFrameImage("hearth").getImage(), 20 + i * 40, 18); } if (state == GameState.GAMEWIN) { g2.DrawImage(CacheDataLoader.getInstance().getFrameImage("gamewin").getImage(), 300, 300); } break; case GameState.GAMEOVER: brush.Color = Color.Black; g2.FillRectangle(brush, 0, 0, GameFrame.SCREEN_WIDTH, GameFrame.SCREEN_HEIGHT); brush.Color = Color.White; g2.DrawString("GAME OVER!", font, brush, 450, 300); break; } } }