//Set story private void UpdateStory() { if (IsBossDead)//出現於BOSS之前 { IsBossDead = false; Time += ((int)gameTime.Elapsed.TotalSeconds) + 1; gameTime.Reset(); Update.Stop(); FunctionObjTimer.Stop(); labelContext.Visible = true; labelContext.Text = storyBox.getStoryContent(); } }
private void GameOver() { if (Life > 0) { Life--; player.setOPEndTime(int.Parse(labelTime.Text), 2); Playerdie.Play(); labelHP.Text = Life.ToString(); } if (Life <= 0) { BGMPlayer.Ctlcontrols.stop(); AttackPlayer.Stop(); GMG.Play(); panel3.Visible = true; Update.Stop(); FunctionObjTimer.Stop(); gameTime.Stop(); } }
public Game(int inputLife, int flx, int fly) { InitializeComponent(); //Form location this.Location = new Point(flx, fly); //SFX EnterBtn = new SoundPlayer(Application.StartupPath + @"\SFX\click_touch.wav"); btnLeave.MouseEnter += btnStoreGrade_MouseEnter; ClickBtn = new SoundPlayer(Application.StartupPath + @"\SFX\click_click.wav"); btnLeave.MouseClick += btnStoreGrade_MouseClick; Enemydie = new SoundPlayer(Application.StartupPath + @"\SFX\enemydie.wav"); GMG = new SoundPlayer(Application.StartupPath + @"\SFX\playerdie.wav"); Playerdie = new SoundPlayer(Application.StartupPath + @"\SFX\playerhurted.wav"); AttackPlayer = new SoundPlayer(Application.StartupPath + @"\SFX\se_plst00.wav"); GetObj = new SoundPlayer(Application.StartupPath + @"\SFX\GetThing.wav"); BGMPlayer.URL = @"SFX\bg.mp3"; BGMPlayer.settings.setMode("Loop", true); BGMPlayer.settings.volume = 8; trackBarVolume.Value = BGMPlayer.settings.volume; BGMPlayer.Ctlcontrols.play(); Randomizer = new Random(); playerBullet = new List <Bullet>(); enemyBullet = new List <EnemyBullet>(); enemies = new List <Enemy>(); functionObj = new List <FunctionObject>(); enemyFactory = new EnemyFactory(enemies); Score = 0; player = new Player(300, 500); initalLife = inputLife; Life = initalLife; Time = 0; labelTime.Text = Time.ToString();; labelScore.Text = "0"; labelHP.Text = initalLife.ToString(); labelContext.Text = ""; //Story mode storyBox = new StoryBox(); gameTime.Reset(); Update.Stop(); FunctionObjTimer.Stop(); //background code background1 = new System.Windows.Forms.PictureBox(); background1.Location = new Point(0, 0); background1.Image = Image.FromFile(Application.StartupPath + "\\assest\\Background\\stage04.png"); background1.Width = background1.Image.Width; background1.Height = background1.Image.Height; background2 = new System.Windows.Forms.PictureBox(); background2.Location = new Point(0, -580); background2.Image = Image.FromFile(Application.StartupPath + "\\assest\\Background\\stage04.png");; background2.Width = background2.Image.Width; background2.Height = background2.Image.Height; b1y = 0; b2y = -580; }