private void ControlTopAndDown() { if (top == false) { if (!pictureBoxEnemy.Bounds.IntersectsWith(DownWall.Bounds)) { Enemy.MoveDown(pictureBoxEnemy, 10); } else { top = true; // } } else if (top == true) { if (!pictureBoxEnemy.Bounds.IntersectsWith(TopWall.Bounds)) { Enemy.MoveUP(pictureBoxEnemy, 10); } else { top = false; } } }
private void timer1_Tick(object sender, EventArgs e) { //if (pictureBoxPlayer.Bounds.Top < pictureBoxEnemy.Bounds.Bottom) //{ // Enemy.MoveUP(pictureBoxEnemy, 300); // Player.Health -= 10; // LabelHealth.Text = Player.Health.ToString() + "%"; //} if (pictureBoxPlayer.Bounds.IntersectsWith(pictureBoxEnemy.Bounds)) { Enemy.MoveUP(pictureBoxEnemy, 500); } else { ControlLeftRight(); ControlTopAndDown(); } }