private void Three(Direction position, List <Alien> aliens) { SpacePoint p = PositionPoint(position); AddRandomEnemy(aliens, p.X, p.Y + 60, position); AddRandomEnemy(aliens, p.X + 50, p.Y, position); AddRandomEnemy(aliens, p.X - 50, p.Y, position); }
/// <summary> /// Параметры: начальные координаты и размеры корабля. /// </summary> /// <param name="y"></param> public Ship(int x, int y, int width, int height) { m_x = x; m_y = y; m_direction = 0; m_armor = 100; m_shield = 100; m_prevArmor = m_armor; m_prevShield = m_shield; m_lives = 2; m_cash = 0; m_powerLevel = 1; m_invulnerability = false; m_secondsOfInvulnerability = 10; m_resurrection = false; m_overheat = false; m_height = height; m_width = width; m_doubleSquare = m_height * m_width; m_points = new SpacePoint[3]; m_points[0] = new SpacePoint(m_x - m_width / 2, m_y + m_height / 2); m_points[1] = new SpacePoint(m_x, m_y - m_height / 2); m_points[2] = new SpacePoint(m_x + m_width / 2, m_y + m_height / 2); //Инициализация боеприпасов m_magazine = new List <Bullet>(); for (int i = 0; i < 50; i++) { m_magazine.Add(new Bullet()); } m_currentBullet = 0; int speed = -10; int shift = 0; //Размещение оружия относительно корпуса корабля m_mainCannon = new Cannon(this, 0, -m_height / 2, shift, speed); m_leftCannon = new Cannon(this, -m_width / 2 + 10, -m_height / 2 + 5, shift, speed); m_rightCannon = new Cannon(this, m_width / 2 - 10, -m_height / 2 + 5, shift, speed); m_leftSideCannon = new Cannon(this, -m_width / 2 + 3, 0, shift, speed); m_rightSideCannon = new Cannon(this, m_width / 2 - 3, 0, shift, speed); SetPowerLevel(1); m_lastRefresh = DateTime.Now; wmp = new WMPLib.WindowsMediaPlayer(); }
private void One(Direction position, List <Alien> aliens) { SpacePoint p = PositionPoint(position); int x, y; x = p.X; y = p.Y; AddRandomEnemy(aliens, x, y, position); //aliens.Add(new Alien(x, y, 70, 65, // position)); }
/// <summary> /// Границы космоса /// </summary> /// <param name="width"></param> /// <param name="height"></param> public StageDirector(int width, int height) { m_width = width; m_height = height; m_interval = width / 3; int m_step = -40; m_left = new SpacePoint(m_interval / 2, m_step); m_right = new SpacePoint(m_width - m_interval / 2, m_step); m_center = new SpacePoint(m_width / 2, m_step); m_rnd = new Random(); m_playing = false; wmp = new WMPLib.WindowsMediaPlayer(); wmp.settings.setMode("Loop", true); wmp.settings.volume = 90; }
public Alien(int x, int y, int width, int height, Direction position) { m_rnd = new Random(); m_speed = 4; //Определение поведения корабля, //его прямой полет либо полет со стрейфом //после достижения опереденного расстояния if (position == Direction.Center) { m_direction = (Direction)m_rnd.Next(3); } else { if (position == Direction.Left) { m_direction = (Direction)m_rnd.Next(1, 2); } if (position == Direction.Right) { m_direction = (Direction)m_rnd.Next(2); } } m_health = 100; m_x = x; m_y = y; m_width = width; m_height = height; m_lastShot = DateTime.Now; m_points = new SpacePoint[4]; m_points[0] = new SpacePoint(m_x - m_width / 2, m_y - m_height / 2); m_points[1] = new SpacePoint(m_x + m_width / 2, m_y - m_height / 2); m_points[2] = new SpacePoint(m_x + m_width / 2, m_y + m_height / 2); m_points[3] = new SpacePoint(m_x - m_width / 2, m_y + m_height / 2); }