public TBoard() { InitializeComponent(); MouseWheel += MakeZoom; DoubleBuffered = true; PlayTimer.Start(); }
private void restart() { levelcounter.Text = Level.ToString(); if (Level >= 1) { //this sets the ships at level 1 and above to be at their default positions enemyship1.Location = new Point(21, 12); enemyship2.Location = new Point(131, 12); enemyship3.Location = new Point(257, 12); enemyship4.Location = new Point(380, 12); enemyship1.Visible = true; enemyship2.Visible = true; enemyship3.Visible = true; enemyship4.Visible = true; enemybullet1.Visible = true; enemybullet2.Visible = true; enemybullet3.Visible = true; enemybullet4.Visible = true; enemybullet1.Location = enemyship1.Location; enemybullet2.Location = enemyship2.Location; enemybullet3.Location = enemyship3.Location; enemybullet4.Location = enemyship4.Location; } if (Level > 1) { // after level one, two more ships appear at their default positions enemyship5.Location = new Point(459, 100); enemyship6.Location = new Point(597, 100); enemybullet5.Location = enemyship5.Location; enemybullet6.Location = enemyship6.Location; enemyship5.Visible = true; enemyship6.Visible = true; enemybullet5.Visible = true; enemybullet6.Visible = true; // this background image for level 2 is set in this conditon if (Level == 2) { Image myimage = new Bitmap(@"bg2.png"); this.BackgroundImage = myimage; } // this background image for level 3 is set in this conditon if (Level == 3) { Image myimage = new Bitmap(@"bg3.png"); this.BackgroundImage = myimage; } } scorecounter.Visible = false; scorelabel.Visible = false; gameoverlabel.Visible = false; heroship1.Visible = true; laser.Visible = true; randint.Start(); enemyshiptimer.Start(); MainButton.Visible = false; PlayTimer.Start(); }
public Form1() { InitializeComponent(); tBoard1.Game.Timer = PlayTimer; tBoard1.Scroll += TBoard1_Scroll; PlayTimer.Start(); }
public void Play() { if (seqLoaded) { mPlaying = true; watch.Start(); PlayTimer.Start(); } }
/// <summary> /// För att starta spelet /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnStart_Click(object sender, EventArgs e) { //Run randomiser if not using loaded SaveGame("DefaultGameName"); savegame = true; btnPause.Enabled = true; btnStart.Enabled = false; PlayTimer.Start(); }
public Form2() { InitializeComponent(); PlayTimer.Start(); healthcounter.Text = herohealth.ToString(); this.ActiveControl = heroship1; bool shoot = false; }
private void restart() { levelcounter.Text = Level.ToString(); if (Level >= 1) { enemyship1.Location = new Point(21, 12); enemyship2.Location = new Point(131, 12); enemyship3.Location = new Point(257, 12); enemyship4.Location = new Point(380, 12); enemyship1.Visible = true; enemyship2.Visible = true; enemyship3.Visible = true; enemyship4.Visible = true; enemybullet1.Visible = true; enemybullet2.Visible = true; enemybullet3.Visible = true; enemybullet4.Visible = true; enemybullet1.Location = enemyship1.Location; enemybullet2.Location = enemyship2.Location; enemybullet3.Location = enemyship3.Location; enemybullet4.Location = enemyship4.Location; herohealth = 3; } if (Level > 1) { enemyship5.Location = new Point(459, 100); enemyship6.Location = new Point(597, 100); enemybullet5.Location = enemyship5.Location; enemybullet6.Location = enemyship6.Location; enemyship5.Visible = true; enemyship6.Visible = true; enemybullet5.Visible = true; enemybullet6.Visible = true; BackgroundImage = Properties.Resources.bg2; } scorecounter.Visible = false; scorelabel.Visible = false; gameoverlabel.Visible = false; heroship1.Visible = true; laser.Visible = true; randint.Start(); enemyshiptimer.Start(); MainButton.Visible = false; PlayTimer.Start(); }
/// <summary> /// Knapp för att pausa spelet. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPause_Click(object sender, EventArgs e) { if (btnPause.Text == "Pause") { PlayTimer.Stop(); btnPause.Text = "Continue"; } else { btnPause.Text = "Pause"; PlayTimer.Start(); } }
public Form2() { InitializeComponent(); // these are global variables A_Journey_Home.Variables.aggregatescore = 0; A_Journey_Home.Variables.herohealth = 3; // this is the main timer for all of the bullets PlayTimer.Start(); // gives the level counter the value of the health variables healthcounter.Text = A_Journey_Home.Variables.herohealth.ToString(); // this gives the user activecontrol to the heroship this.ActiveControl = heroship1; bool shoot = false; }
public void Save(Version fv, WsgFileStream fs) { try { if (BeforeSaveEvent != null) { BeforeSaveEvent(); } if (fv.Major > 0) { while (PlayTimer.Enabled) { PlayTimer.Stop(); } fs.Seek(0, System.IO.SeekOrigin.Begin); FileVersion.Save(fv, fs); StockIndexes.Save(fv, fs); Stocks.Save(fv, fs); Players.Save(fv, fs); MarketState.Save(fv, fs); fs.Flush(); FileName = fs.Name; while (!PlayTimer.Enabled) { PlayTimer.Start(); } } if (AfterSaveEvent != null) { AfterSaveEvent(); } if (UpdateStockInformationsEvent != null) { UpdateStockInformationsEvent(); } if (UpdatePlayerInformationsEvent != null) { UpdatePlayerInformationsEvent(); } } catch (System.Exception ex) { while (!PlayTimer.Enabled) { PlayTimer.Start(); } throw ex; } }
private void PlayBtn_Click(object sender, EventArgs e) { System.Media.SoundPlayer player = new System.Media.SoundPlayer(); player.Stream = Properties.Resources.Believer3; //player.SoundLocation = @"C:\Users\acer\Desktop\Things\Music\wav\My Dearest.wav"; player.Play(); Taiko1.Visible = true; Taikotimer.Start(); ScoreTimer.Start(); PlayTimer.Start(); taikocount = 0; myscore = 0; owari.Visible = false; }
/// <summary> /// För att ladda ett redan sparat spel och spela upp det. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLoad_Click(object sender, EventArgs e) { if (lstBxSavedGames.SelectedItem != null) { string gameName = lstBxSavedGames.SelectedItem.ToString(); string loadedGameRound = manageDB.GetPlayingfield(gameName); if (loadedGameRound != "") { s.GridSize = manageDB.GetSavedGridSize(); MakeLoadedRoundToAnArray(loadedGameRound); UpdateGrid(); btnStart.Enabled = false; savegame = false; PlayTimer.Start(); } } }
public void Reset(System.Random random, bool startingserver) { try { bool b = true; if (BeforeResetEvent != null && !startingserver) { b = BeforeResetEvent(); } if (b) { while (PlayTimer.Enabled) { PlayTimer.Stop(); } FileName = null; Stocks.Reset(random); Players.Reset(random); MarketState.Reset(random); while (!PlayTimer.Enabled) { PlayTimer.Start(); } if (AfterResetEvent != null && !startingserver) { AfterResetEvent(); } if (UpdateStockInformationsEvent != null) { UpdateStockInformationsEvent(); } if (UpdatePlayerInformationsEvent != null) { UpdatePlayerInformationsEvent(); } } } catch (System.Exception ex) { throw ex; } }
public void Continue() { try { if (IsPaused) { while (!PlayTimer.Enabled) { PlayTimer.Start(); } if (OnContinueEvent != null) { OnContinueEvent(); } } } catch (System.Exception ex) { throw ex; } }
public static void OnPickedInstrument(Mobile from, BaseInstrument instrument) { PlayerMobile pm = (PlayerMobile)from; if (!instrument.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); //This must be in your backpack } else if (instrument is Drums || instrument is Tambourine || instrument is TambourineTassel) { from.SendMessage("You cannot play a tune on that instrument."); BaseInstrument.SetInstrument(from, null); } else if (!pm.Playing) // If this is a new tune, create a new timer and start it. { from.Emote("*plays a tune*"); // Player emotes to indicate they are playing pm.Playing = true; PlayTimer pt = new PlayTimer(pm); pt.Start(); } }
public System.Object Load(Version fv, WsgFileStream fs, System.Object obj) { try { if (BeforeLoadEvent != null) { BeforeLoadEvent(); } if (fv.Major > 0) { while (PlayTimer.Enabled) { PlayTimer.Stop(); } fs.Seek(0, System.IO.SeekOrigin.Begin); Version loadedfv = (Version)FileVersion.Load(fv, fs, null); while (StockIndexes.Count > 0) { StockIndexes.Clear(); } while (Stocks.Count > 0) { Stocks.Clear(); } while (Players.Count > 0) { Players.Clear(); } MarketState.Reset(Random); CurrentPlayer = null; StockIndexes.Load(loadedfv, fs, null); Stocks.Load(loadedfv, fs, StockIndexes); CurrentPlayer = (Player)Players.Load(loadedfv, fs, Stocks); MarketState.Load(loadedfv, fs, null); FileName = fs.Name; while (!PlayTimer.Enabled) { PlayTimer.Start(); } } if (AfterLoadEvent != null) { AfterLoadEvent(); } if (UpdateStockInformationsEvent != null) { UpdateStockInformationsEvent(); } if (UpdatePlayerInformationsEvent != null) { UpdatePlayerInformationsEvent(); } return(this); } catch (VersionNotSupportedException ex) { while (!PlayTimer.Enabled) { PlayTimer.Start(); } throw ex; } catch (System.Exception ex) { while (!PlayTimer.Enabled) { PlayTimer.Start(); } throw ex; } }