Skip to content
Snippets Groups Projects
Commit c18812b7 authored by Trandinh Thien's avatar Trandinh Thien
Browse files

Added comments and cleaned up some parts in game.cs and windows Form classes

parent 3a724039
No related branches found
No related tags found
No related merge requests found
......@@ -23,29 +23,29 @@ namespace Controller
public class Game : Microsoft.Xna.Framework.Game
{
enum GameState //enumerated list for objects in menu
enum GameState //enumerated list for different possible Game States
{
MainMenu,
HowToPlay,
Playing,
DropDownMenu,
CharMenu,
AttackMenu,
MainMenu, //menu screen
HowToPlay, //Instruction Screen
Playing, //Playing game Screen
DropDownMenu, //Drop down menu for action
CharMenu, //character drop down info menu
AttackMenu, //attack menu
}
GameState CurrentGameState = GameState.MainMenu;
readonly GameFunction gameFunction = new GameFunction();
GameState CurrentGameState = GameState.MainMenu; //game starts in main menu screen
readonly GameFunction gameFunction = new GameFunction();
readonly MouseHandler mouseHandler = new MouseHandler();
MainMenu mMenu; //menu variable
HowToPlay tut;
MainMenu mMenu; //main menu variable
HowToPlay tut; //instruction screen variable
Graph graph;
Player player1;
Player player2;
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Texture2D backGround, MainMenu;
Texture2D backGround;
// constructor for game
public Game()
......@@ -55,6 +55,7 @@ namespace Controller
graphics.PreferredBackBufferHeight = gameFunction.SCREEN_WIDTH;
Content.RootDirectory = "Content";
//instantiate the game windows
mMenu = new MainMenu();
tut = new HowToPlay();
}
......@@ -65,7 +66,7 @@ namespace Controller
protected override void Initialize()
{
Form MyGameForm = (Form)Form.FromHandle(Window.Handle); // creates handle
MyGameForm.Opacity = 0; // screen to invisible
MyGameForm.Opacity = 0; // hides the game window until it's set to visible
base.Initialize();
}
......@@ -118,22 +119,24 @@ namespace Controller
}
MouseState mouse = Mouse.GetState();
//Lists possible game states
switch (CurrentGameState)
{
case GameState.MainMenu: // if mouse is clicked... call method
mMenu.Show(); // show main menu
if (mMenu.start == true)
if (mMenu.start == true) //if New game is selected
{
mMenu.Close();
Form GameForm = (Form)Form.FromHandle(Window.Handle);
mMenu.Close(); //close Main Menu screen
tut.Close(); //close How To Play Menu
Form GameForm = (Form)Form.FromHandle(Window.Handle);
GameForm.Opacity = 100; // make screen show
CurrentGameState = GameState.Playing;
CurrentGameState = GameState.Playing; //set game state to Playing
break;
}
if (mMenu.getInstruct() == true)
if (mMenu.getInstruct() == true) //if How to Play is selected
{
mMenu.Hide();
CurrentGameState = GameState.HowToPlay;
mMenu.Hide(); //hide visibility of menu window
CurrentGameState = GameState.HowToPlay; //change game state to How To Play
break;
}
if (mMenu.quit == true) // if quit clicked
......@@ -144,13 +147,13 @@ namespace Controller
break;
case GameState.HowToPlay: // if true.. load new image...
tut.Show();
tut.Show(); //set visibility of how to play window to true
mMenu.setInstructFalse();
if (tut.getQuit() == true) // if quit clicked
{
tut.setQuitFalse();
tut.Hide();
CurrentGameState = GameState.MainMenu;
tut.Hide(); //hide
CurrentGameState = GameState.MainMenu; //changes state back to main menu
break;
}
break;
......@@ -173,6 +176,7 @@ namespace Controller
{
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null); // begin spriteBatch
//only draw objects relevent to current game state
switch (CurrentGameState)
{
case GameState.Playing: // while in game
......
......@@ -25,10 +25,12 @@ namespace View
quit = true; // check if user quits
}
//checks if Game State is no longer inside How To Play
public void setQuitFalse()
{
quit = false;
}
//returns if quit button is currently clicked
public Boolean getQuit()
{
return quit;
......
......@@ -27,26 +27,23 @@ namespace View
start = true; // check if user starts game
}
private void Load_Click(object sender, EventArgs e)
{
load = true; // check if user starts game
}
private void howToPlay_Click(object sender, EventArgs e)
{
instruct = true; // check if user wants instructions
}
//sets instruct to false when no longer on how-to-play gameState
public void setInstructFalse()
{
instruct = false;
instruct = false;
}
//returns current instruct boolean
public Boolean getInstruct()
{
return instruct;
}
//checks if exit is clicked
private void Exit_Click(object sender, EventArgs e)
{
quit = true; // check if user quits
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -8,7 +8,7 @@
<Processor>TextureProcessor</Processor>
<Options>None</Options>
<Output>C:\Users\chaos\Documents\Git\Blaze-Brigade\src\Blaze-Brigade\Blaze_Brigade\bin\x86\Debug\Content\charSprite.xnb</Output>
<Time>2016-10-18T13:51:08.0660613-04:00</Time>
<Time>2016-10-24T18:32:57.4799277-04:00</Time>
</Item>
<Item>
<Source>MenuImage.jpg</Source>
......@@ -17,7 +17,7 @@
<Processor>TextureProcessor</Processor>
<Options>None</Options>
<Output>C:\Users\chaos\Documents\Git\Blaze-Brigade\src\Blaze-Brigade\Blaze_Brigade\bin\x86\Debug\Content\MenuImage.xnb</Output>
<Time>2016-10-24T11:42:46.4629535-04:00</Time>
<Time>2016-10-24T18:32:57.4779571-04:00</Time>
</Item>
<Item>
<Source>Game_Map.jpg</Source>
......@@ -26,7 +26,7 @@
<Processor>TextureProcessor</Processor>
<Options>None</Options>
<Output>C:\Users\chaos\Documents\Git\Blaze-Brigade\src\Blaze-Brigade\Blaze_Brigade\bin\x86\Debug\Content\Game_Map.xnb</Output>
<Time>2016-10-24T15:19:53.7998324-04:00</Time>
<Time>2016-10-24T18:32:57.4769201-04:00</Time>
</Item>
<BuildSuccessful>true</BuildSuccessful>
<Settings>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment