//Update anything in game pre-render public void UpdateGame() { for (int i = 0; i < Ballistic.activeBallistics.Count; i++) { Ballistic temp = Ballistic.activeBallistics[i]; temp.MoveBallistic(); temp.CheckIfPassedScreen(BallisticsWindow.ActiveForm); } }
public void Render(Graphics g) { for (int i = 0; i < Ballistic.activeBallistics.Count; i++) { Ballistic temp = Ballistic.activeBallistics[i]; g.DrawRectangle(temp.Color, temp.x, temp.y, temp.w, temp.h); } }
//Handler User Input #region KeyPress Handler public void KeyPressHandler(object sender, KeyEventArgs e) { //Normal Bullet if (e.KeyCode == Keys.D1 || e.KeyCode == Keys.NumPad1) { Ballistic b = new Ballistic(3.0f, 3.0f, BulletLazerSource.Left, BulletLazerSource.Top, 17.0f, 0.0f, Color.Black, 0); Ballistic.activeBallistics.Add(b); } //Lazer else if (e.KeyCode == Keys.D2 || e.KeyCode == Keys.NumPad2) { Ballistic b = new Ballistic(15.0f, 0.50f, BulletLazerSource.Left, BulletLazerSource.Top, 5.0f, 0.0f, Color.Red, 1); Ballistic.activeBallistics.Add(b); } //Arrow else if (e.KeyCode == Keys.D3 || e.KeyCode == Keys.NumPad3) { Ballistic b = new Ballistic(10, 0.3f, BulletLazerSource.Left, BulletLazerSource.Top, 4.0f, 1.0f, Color.Chocolate, 2); Ballistic.activeBallistics.Add(b); } //Mortar else if (e.KeyCode == Keys.D4 || e.KeyCode == Keys.NumPad4) { Ballistic b = new Ballistic(5, 5, MortarSource.Left, MortarSource.Top, 3.0f, 13.0f, Color.Black, 3); Ballistic.activeBallistics.Add(b); } }