Пример #1
0
        /// When the "Play Game" button is pressed, close the menu and open the game
        private void NewGameButton_Click(object sender, EventArgs e)
        {
            this.Hide();
            FrmMap gameMap = new FrmMap();

            gameMap.ShowDialog();
        }
Пример #2
0
        private void btnNewGame_Click(object sender, EventArgs e)
        {
            game = Game.GetGame();
            FrmMap frmMap = new FrmMap();

            frmMap.Show();
            this.Hide();
        }
Пример #3
0
        private void Respawn()
        {
            this.Close();
            Game.GetGame().ChangeState(GameState.ON_MAP);
            FrmMap frmMap = new FrmMap("Resources/titleScreen.txt");

            frmMap.ShowDialog();    // shows title screen
        }
Пример #4
0
        //Load game button
        private void button3_Click(object sender, EventArgs e)
        {
            //Create a new map form with loading = true, show it, then close the current form
            var newForm = new FrmMap(false, true);      // open at start of game or when walking on quit space

            newForm.Show();
            this.Close();
        }
Пример #5
0
        //New game button
        private void button2_Click(object sender, EventArgs e)  // maybe we can set the GameState to LVL1 after clicking this?
        {
            //Create a new map form without loading then show it and close the menu
            var newForm = new FrmMap(false, false);

            newForm.Show();
            this.Close();
        }
Пример #6
0
        private void FrmMap_KeyDown(object sender, KeyEventArgs e)
        {
            MoveDir dir = MoveDir.NO_MOVE;

            switch (e.KeyCode)
            {
            case Keys.Left:
                dir = MoveDir.LEFT;
                break;

            case Keys.Right:
                dir = MoveDir.RIGHT;
                break;

            case Keys.Up:
                dir = MoveDir.UP;
                break;

            case Keys.Down:
                dir = MoveDir.DOWN;
                break;
            }
            if (dir != MoveDir.NO_MOVE)
            {
                character.Move(dir);
                if (game.State == GameState.FIGHTING)
                {
                    FrmArena frmArena = new FrmArena(inventory, "reg");
                    frmArena.Show();
                }
                if (game.State == GameState.LVL2)    // if the player lands on the lvl 2 square, the old map is hidden and the new map is formed
                {
                    FrmMap frmMap = new FrmMap(true, true);
                    frmMap.Show();
                    this.Close();
                }
                else if (game.State == GameState.LVL1)   // for when in lvl 2, go back to lvl 1 if on square
                {
                    FrmMap frmMap = new FrmMap(true, true);
                    frmMap.Show();
                    this.Close();
                }
                else if (game.State == GameState.TITLE_SCREEN)
                {
                    var newForm = new FrmMainMenu();
                    newForm.Show();
                    this.Close();
                }
                if (game.State == GameState.BOSS)
                {
                    FrmArena frmArena = new FrmArena(inventory, "boss");
                    frmArena.Show();
                }
            }
        }
Пример #7
0
        private void Btn_startgame_Click(object sender, EventArgs e)
        {
            FrmMap newgame = new FrmMap("level-1");

            newgame.Show();
        }
Пример #8
0
        private void FrmMap_KeyDown(object sender, KeyEventArgs e)
        {
            // don't allow movement if the player is in a fight
            if (game.State == GameState.FIGHTING)
            {
                return;
            }

            MoveDir dir = MoveDir.NO_MOVE;

            switch (e.KeyCode)
            {
            case Keys.Left:
                dir = MoveDir.LEFT;
                break;

            case Keys.Right:
                dir = MoveDir.RIGHT;
                break;

            case Keys.Up:
                dir = MoveDir.UP;
                break;

            case Keys.Down:
                dir = MoveDir.DOWN;
                break;

            case Keys.O:
                if (game.State != GameState.OPTIONS)
                {
                    FrmOptions frmOptions = new FrmOptions();
                    frmOptions.StartPosition = FormStartPosition.CenterScreen;
                    frmOptions.Show();
                    Console.WriteLine("showed");
                }
                break;
            }
            if (dir != MoveDir.NO_MOVE)
            {
                character.Move(dir);
                if (game.State == GameState.CHANGE_LEVEL1) //TLF
                {
                    this.Hide();                           // hides/close old window
                    Game.GetGame().ChangeState(GameState.ON_MAP);
                    FrmMap frmMap = new FrmMap("Resources/level.txt");
                    frmMap.Show();    // shows LEVEL 1 window
                }
                if (game.State == GameState.CHANGE_LEVEL)
                {
                    this.Hide();      // hides/close old window
                    Game.GetGame().ChangeState(GameState.ON_MAP);
                    FrmMap frmMap = new FrmMap("Resources/level2.txt");
                    frmMap.Show();                   // shows level 2 window
                }
                if (game.State == GameState.RESPAWN) //will take you back to titleScreen TLF
                {
                    this.Hide();                     // hides/close old window
                    Game.GetGame().ChangeState(GameState.ON_MAP);
                    FrmMap frmMap = new FrmMap("Resources/titleScreen.txt");
                    frmMap.Show();    // shows Title screen window
                }


                if (game.State == GameState.FIGHTING)
                {
                    FrmArena frmArena = new FrmArena();
                    frmArena.Show();
                }
                if (game.State == GameState.QUIT)//TLF
                {
                    // Changed this.Hide() to Close() because
                    // this.Hide() keeps the program running
                    // while Close() quits it altogether

                    //Application.Exit() would also work TLF

                    // BYR: You're right fam
                    Application.Exit();
                }
            }
        }
Пример #9
0
 public void parentForm(FrmMap map)
 {
     parentMap = map;
 }