private void startTimer_Tick(object sender, EventArgs e) { timercounter--; switch (timercounter) { case 3: three.Visibility = Visibility.Visible; break; case 2: three.Visibility = Visibility.Collapsed; two.Visibility = Visibility.Visible; break; case 1: two.Visibility = Visibility.Collapsed; one.Visibility = Visibility.Visible; break; case 0: one.Visibility = Visibility.Collapsed; instruction.Visibility = Visibility.Collapsed; moving.Width = game.Orgwidth; moving.Height = game.Orgwidth; EllipseX.SetCenter(moving, 384, 224); moving.Visibility = Visibility.Visible; gametimer.Start(); starttimer.Stop(); break; } }
private int status; //1: playing, 2: win, 3: lose public Capture(Player p, PokemonType x) { InitializeComponent(); EllipseX.SetCenter(objective, 384, 224); EllipseX.SetCenter(moving, 384, 224); p1 = p; pkm = x; game = new CaptureGame(x); status = 1; balltimer.Tick += ballTimer_Tick; balltimer.Interval = TimeSpan.FromSeconds(0.1); gametimer.Tick += gameTimer_Tick; gametimer.Interval = TimeSpan.FromSeconds(0.02); switch (pkm.Name) { case "Bulbasaur": Bulbasaur.Visibility = Visibility.Visible; break; case "Squirtle": Squirtle.Visibility = Visibility.Visible; break; case "Charmander": Charmander.Visibility = Visibility.Visible; break; case "Pikachu": Pikachu.Visibility = Visibility.Visible; break; case "Snorlax": Snorlax.Visibility = Visibility.Visible; break; case "Lapras": Lapras.Visibility = Visibility.Visible; break; } ballcount.Text = p1.Pokeball_count.ToString(); if (p1.Pokeball_count > 0) { CountdownTimer(); } else { PokeballExhaust(); } }
private void gameTimer_Tick(object sender, EventArgs e) { int newwidth = game.NextWidth(); if (newwidth < 0) { gametimer.Stop(); p1.RemovePokeball(1); ballcount.Text = p1.Pokeball_count.ToString(); checkresult(); return; } moving.Width = newwidth; moving.Height = newwidth; EllipseX.SetCenter(moving, 384, 224); }