private void Button_End_Click(object sender, EventArgs e) { Label_DiceNumber.ForeColor = Color.Black; Label_DiceNumber.BackColor = Color.White; Label_DiceNumber.Font = new Font("新細明體", 24, FontStyle.Regular); now_player = (now_player + 1) % Constants.PLAYER_NUMBER; while (players[now_player].State == PlayerState.Dead) { now_player = (now_player + 1) % Constants.PLAYER_NUMBER; } Label_DiceNumber.ForeColor = Color.Black; now_state = GameState.Initial; UpdateUI(); PictureBox_Map.Refresh(); PictureBox_MiniMap.Refresh(); }
private void Form1_Load(object sender, EventArgs e) { Button_Test.Enabled = false; Start_button.Hide(); map = new Bitmap("map.png"); PictureBox_MiniMap.Load("map.png"); PictureBox_MiniMap.SizeMode = PictureBoxSizeMode.StretchImage; Start_button.Enabled = false; Label_Player_HPBar = new Label[Constants.PLAYER_NUMBER]; Label_Player_APBar = new Label[Constants.PLAYER_NUMBER]; Label_Player_HPText = new Label[Constants.PLAYER_NUMBER]; Label_Player_APText = new Label[Constants.PLAYER_NUMBER]; GroupBox_Player_Area = new GroupBox[Constants.PLAYER_NUMBER]; players = new Player[Constants.PLAYER_NUMBER]; random = new Random(); now_player = 0; step = 0; blocks = new Block[Constants.BLOCK_NUMBER]; blocks[0] = new StartBlock(new Point(0, 0)); blocks[1] = new RestBlock(new Point(100, 0)); blocks[2] = new ArmorBlock(new Point(200, 0)); blocks[3] = new ArmorBlock(new Point(300, 0)); blocks[4] = new ArmorBlock(new Point(400, 0)); blocks[5] = new EquipsBlock(new Point(500, 0)); blocks[6] = new ArmorBlock(new Point(600, 0)); blocks[7] = new RestBlock(new Point(700, 0)); blocks[8] = new ArmorBlock(new Point(800, 0)); blocks[9] = new ArmorBlock(new Point(900, 0)); blocks[10] = new MagicSpellBlock(new Point(900, 100)); blocks[11] = new EquipsBlock(new Point(900, 200)); blocks[12] = new TrapBlock(new Point(900, 300)); blocks[13] = new ArmorBlock(new Point(900, 400)); blocks[14] = new MagicSpellBlock(new Point(900, 500)); blocks[15] = new ArmorBlock(new Point(1000, 500)); blocks[16] = new ArmorBlock(new Point(1100, 500)); blocks[17] = new ArmorBlock(new Point(1200, 500)); blocks[18] = new ArmorBlock(new Point(1300, 500)); blocks[19] = new DeadLandsBlock(new Point(1300, 600)); blocks[20] = new DragonBlock(new Point(1300, 700)); blocks[21] = new LonelyMountainBlock(new Point(1300, 800)); blocks[22] = new RestBlock(new Point(1200, 800)); blocks[23] = new ArmorBlock(new Point(1100, 800)); blocks[24] = new ArmorBlock(new Point(1000, 800)); blocks[25] = new ArmorBlock(new Point(900, 800)); blocks[26] = new TrapBlock(new Point(900, 700)); blocks[27] = new DeadLandsBlock(new Point(800, 700)); blocks[28] = new EquipsBlock(new Point(700, 700)); blocks[29] = new ArmorBlock(new Point(600, 700)); blocks[30] = new MagicSpellBlock(new Point(500, 700)); blocks[31] = new ArmorBlock(new Point(400, 700)); blocks[32] = new ArmorBlock(new Point(300, 700)); blocks[33] = new RestBlock(new Point(200, 700)); blocks[34] = new ArmorBlock(new Point(100, 700)); blocks[35] = new ArmorBlock(new Point(0, 700)); blocks[36] = new TrapBlock(new Point(0, 600)); blocks[37] = new ArmorBlock(new Point(0, 500)); blocks[38] = new ArmorBlock(new Point(0, 400)); blocks[39] = new EquipsBlock(new Point(0, 300)); blocks[40] = new ArmorBlock(new Point(0, 200)); blocks[41] = new ArmorBlock(new Point(0, 100)); now_state = GameState.Initial; UpdateUI(); }
private void Timer_Process_Tick(object sender, EventArgs e) { int counter = 0; if (step != 0) { if (PlayerMove()) { players[now_player].BlockIndex = (players[now_player].BlockIndex + 1) % Constants.BLOCK_NUMBER; --step; if (blocks[players[now_player].BlockIndex] is StartBlock) { blocks[players[now_player].BlockIndex].ExcecuteAction(players[now_player]); UpdateHP(); } if (step == 0) { if (blocks[players[now_player].BlockIndex] is ArmorBlock) { blocks[players[now_player].BlockIndex].ExcecuteAction(players[now_player]); UpdateHP(); } else if (blocks[players[now_player].BlockIndex] is TrapBlock) { blocks[players[now_player].BlockIndex].ExcecuteAction(players[now_player]); UpdateHP(); } else if (blocks[players[now_player].BlockIndex] is RestBlock) { blocks[players[now_player].BlockIndex].ExcecuteAction(players[now_player]); UpdateHP(); } else if (blocks[players[now_player].BlockIndex] is EquipsBlock) { blocks[players[now_player].BlockIndex].ExcecuteAction(players[now_player]); UpdateHP(); } else if (blocks[players[now_player].BlockIndex] is LonelyMountainBlock) { blocks[players[now_player].BlockIndex].ExcecuteAction(players[now_player]); UpdateHP(); } else if (blocks[players[now_player].BlockIndex] is DeadLandsBlock) { blocks[players[now_player].BlockIndex].ExcecuteAction(players[now_player]); UpdateHP(); } else if (blocks[players[now_player].BlockIndex] is DragonBlock) { blocks[players[now_player].BlockIndex].ExcecuteAction(players[now_player]); UpdateHP(); } else if (blocks[players[now_player].BlockIndex] is MagicSpellBlock) { for (counter = 0; counter < 4; counter++) { players[counter].HP -= 4; } players[now_player].HP += 4; UpdateHP(); } now_state = GameState.Stopped; UpdateUI(); } } PictureBox_Map.Refresh(); PictureBox_MiniMap.Refresh(); } }