/// <summary> /// Handles the animation and physics logic /// </summary> private void timer1_Tick(object sender, EventArgs e) { //if all attack animations have ended if (!currentGame.ProcessWeaponEffects()) { currentGame.ProcessGravity(); //handle all the after - attack gravity cleanup. //redraw everything after potentially moving terrain. DrawBackground(); DrawGameplay(); displayPanel.Invalidate();// method to trigger a redraw. //if some tanks were moved if (currentGame.ProcessGravity()) { return; } // if nothing moved then the turn will end, if there is no more turns the round is over. else { timer1.Enabled = false; if (currentGame.TurnOver()) { NewTurn(); } else { Dispose(); currentGame.NextRound(); return; } } } //Otherwise, attack animations are still ongoing. else { DrawGameplay(); displayPanel.Invalidate(); return; } }
/// <summary> /// the user wishes to continue on. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { continueFight.NextRound(); this.Hide(); // drop the view of form this.Dispose(); // destory form from memory }