public override void dance(Random rand, bool direction, int difficulty, int Left, List <bullet> bullets, Form Form1) { if (direction) { this.Left += this.speed; } else { this.Left -= this.speed; } if (rand.Next(120) == 0) { bullet b1 = new bullet(false, this.Left - 50, this.Width, this.Top + this.Height - 30, this.Height, 2 + difficulty / 7, Color.MediumPurple, 4); bullets.Add(b1); Form1.Controls.Add(b1); b1.BringToFront(); bullet b2 = new bullet(false, this.Left + 20, this.Width, this.Top + this.Height - 50, this.Height, 2 + difficulty / 7, Color.MediumPurple, 4); bullets.Add(b2); Form1.Controls.Add(b2); b2.BringToFront(); bullet b3 = new bullet(false, this.Left - 20, this.Width, this.Top + this.Height - 70, this.Height, 2 + difficulty / 7, Color.MediumPurple, 4); bullets.Add(b3); Form1.Controls.Add(b3); b3.BringToFront(); } }
private void Hero_onFireMissiles() { for (int i = 0; i < 8; i++) { bullet b = new bullet(true, Hero.Left + i * 20 - 70, Hero.Width, Hero.Top, Hero.Height, Hero.attackSpeed, Color.Red, Hero.shotWidth); bullets.Add(b); this.Controls.Add(b); b.BringToFront(); } }
public virtual void dance(Random rand, bool direction, int difficulty, int Left, List <bullet> bullets, Form Form1) { if (direction) { this.Left += this.speed; } else { this.Left -= this.speed; } if (rand.Next(500 - difficulty * 10) == 0) { bullet b = new bullet(false, this.Left, this.Width, this.Top + this.Height, this.Height, 2 + difficulty / 7, Color.MediumPurple, 4); bullets.Add(b); Form1.Controls.Add(b); b.BringToFront(); } }
private void Form1_KeyDown(object sender, KeyEventArgs e) { if (!gameOver && !(HPs == 0)) { if (e.KeyCode == Keys.S) { isSdown = true; } if (e.KeyCode == Keys.ControlKey) { isCtrldown = true; } if (e.KeyCode == Keys.Y) { isYdown = true; } if (!isPaused) { if (e.KeyCode == Keys.Right) { right = true; } if (e.KeyCode == Keys.Left) { left = true; } if (e.KeyCode == Keys.Space && !isLaunched) { bullet b = new bullet(true, Hero.Left, Hero.Width, Hero.Top, Hero.Height, Hero.attackSpeed, Color.Red, Hero.shotWidth); bullets.Add(b); this.Controls.Add(b); b.BringToFront(); isLaunched = true; } if (e.KeyCode == Keys.Tab) { if (Hero.heroChosen == 1) { Hero.BackgroundImage = Properties.Resources.hero2; Hero.speed = 7; Hero.attackSpeed = 5; Hero.shotWidth = 2; } if (Hero.heroChosen == 2) { Hero.BackgroundImage = Properties.Resources.hero3; Hero.speed = 3; Hero.attackSpeed = 2; Hero.shotWidth = 13; } if (Hero.heroChosen == 3) { Hero.BackgroundImage = Properties.Resources.hero1; Hero.speed = 5; Hero.attackSpeed = 4; Hero.shotWidth = 4; } if (Hero.heroChosen != 3) { Hero.heroChosen += 1; } else { Hero.heroChosen = 1; } } if (isReady) { if (e.KeyCode == Keys.Z) { difficulty++; labelToStart.Visible = false; lvlabel.Text = "LVL" + difficulty; isReady = false; switch (difficulty) { case 10: boss1 = new boss1(this.Width / 2, -80, 2, 100, 0); isBoss1 = true; this.Controls.Add(boss1); timer2.Enabled = true; boss1.BringToFront(); break; case 20: boss2 = new boss2(this.Width / 2, -80, 2, 200, 0); isBoss2 = true; this.Controls.Add(boss2); timer3.Enabled = true; boss2.BringToFront(); break; default: for (int i = 0; i < 2; i++) { for (int j = 0; j < 8; j++) { int chance; if (difficulty < 10) { chance = rand.Next(100 - difficulty * 10); } else { chance = 0; } enemy en = new enemy(this.Width - 60 * j - 80 - i * 10, i * 60, 2 + difficulty / 6, (chance == 0) ? 2 : 1, difficulty > 20?4:(!(chance == 0)?1:2)); enemies.Add(en); this.Controls.Add(en); en.BringToFront(); } } break; } } } } if (e.KeyCode == Keys.Escape) { if (isPaused) { timer1.Enabled = true; timer2.Enabled = true; timer3.Enabled = true; pause.Enabled = false; pause.Visible = false; } else { timer1.Enabled = false; timer2.Enabled = false; timer3.Enabled = false; pause.Enabled = true; pause.Visible = true; pause.BackColor = Color.Transparent; pause.Dock = DockStyle.Fill; } isPaused = !isPaused; } } }