/// <summary> /// Создание игровых объетков при загрузке игры /// </summary> public static void Load() { _backObjects = new BaseObject[50]; Random r = new Random(); int randSize; int randSpeed; int randPos; for (int i = 0; i < 20; i++) { randPos = r.Next(1, Game.Width); randSpeed = r.Next(1, 5); _backObjects[i] = new FarStar(new Point(randPos, i * Game.Height / 20 + 10), new Point(randSpeed, 0), new Size(2, 2)); } for (int i = 20; i < 30; i++) { randPos = r.Next(1, Game.Width); randSpeed = r.Next(15, 30); randSize = r.Next(3, 10); _backObjects[i] = new FarAsteroid(new Point(randPos, (i - 20) * Game.Height / 10 + 20), new Point(randSize, 0), new Size(randSize, randSize)); } for (int i = 30; i < 50; i++) { randPos = r.Next(1, Game.Width); randSpeed = r.Next(2, 5); randSize = r.Next(3, 10); _backObjects[i] = new Star(new Point(randPos, (i - 30) * Game.Height / 20 + 20), new Point(randSpeed, 0), new Size(randSize, randSize)); } _asteroids = new Asteroid[5]; for (int i = 0; i < _asteroids.Length; i++) { randPos = r.Next(1, Game.Width); randSpeed = r.Next(15, 25); _asteroids[i] = new Asteroid(new Point(Game.Width, r.Next(1, Game.Height - 35)), new Point(randSpeed, 0), new Size(30, 30), "asteroid.jpg"); } ship = new Ship(new Point(100, 300), new Point(5, 10), new Size(70, 30), "ship.jpg"); _bullet = new Bullet(new Point(0, 0), new Point(50, 0), new Size(15, 3)); _bullet.NewShot(ship); }
/// <summary> /// Создание игровых объетков при загрузке игры /// </summary> public static void Load() { _backObjects = new BaseObject[50]; int randSize; int randSpeed; int randPos; for (int i = 0; i < 20; i++) { randPos = Rnd.Next(1, Game.Width); randSpeed = Rnd.Next(1, 5); _backObjects[i] = new FarStar(new Point(randPos, i * Game.Height / 20 + 10), new Point(randSpeed, 0), new Size(2, 2)); } for (int i = 20; i < 30; i++) { randPos = Rnd.Next(1, Game.Width); randSpeed = Rnd.Next(15, 30); randSize = Rnd.Next(3, 10); _backObjects[i] = new FarAsteroid(new Point(randPos, (i - 20) * Game.Height / 10 + 20), new Point(randSize, 0), new Size(randSize, randSize)); } for (int i = 30; i < 50; i++) { randPos = Rnd.Next(1, Game.Width); randSpeed = Rnd.Next(2, 5); randSize = Rnd.Next(3, 10); _backObjects[i] = new Star(new Point(randPos, (i - 30) * Game.Height / 20 + 20), new Point(randSpeed, 0), new Size(randSize, randSize)); } _asteroids = new Asteroid[5]; for (int i = 0; i < _asteroids.Length; i++) { randPos = Rnd.Next(1, Game.Width); randSpeed = Rnd.Next(15, 25); _asteroids[i] = new Asteroid(new Point(Game.Width, Rnd.Next(1, Game.Height - 45)), new Point(randSpeed, 0), new Size(35, 35), "asteroid.png"); } _repairKit = new RepairKit(new Point(Game.Width, Rnd.Next(1, Game.Height - 35)), new Point(10, 0), new Size(30, 30), "repair_kit.jpg"); _ship = new Ship(new Point(50, 300), new Point(0, 10), new Size(70, 30), "ship.jpg"); }
/// <summary> /// Создание игровых объетков при загрузке игры /// </summary> public static void Load() { _backObjects = new BaseObject[50]; int randSize; int randSpeed; int randPos; for (int i = 0; i < 20; i++) { randPos = Rnd.Next(1, Game.Width); randSpeed = Rnd.Next(1, 5); _backObjects[i] = new FarStar(new Point(randPos, i * Game.Height / 20 + 10), new Point(randSpeed, 0), new Size(2, 2)); } for (int i = 20; i < 30; i++) { randPos = Rnd.Next(1, Game.Width); randSpeed = Rnd.Next(15, 30); randSize = Rnd.Next(3, 10); _backObjects[i] = new FarAsteroid(new Point(randPos, (i - 20) * Game.Height / 10 + 20), new Point(randSize, 0), new Size(randSize, randSize)); } for (int i = 30; i < 50; i++) { randPos = Rnd.Next(1, Game.Width); randSpeed = Rnd.Next(2, 5); randSize = Rnd.Next(3, 10); _backObjects[i] = new Star(new Point(randPos, (i - 30) * Game.Height / 20 + 20), new Point(randSpeed, 0), new Size(randSize, randSize)); } for (int i = 0; i < _amountAsterois; i++) { randSize = Rnd.Next(25, 40); _asteroids.Add(new Asteroid(new Point(Game.Width, Rnd.Next(1, Game.Height - 45)), new Point(Rnd.Next(10, 20), 0), new Size(randSize, randSize))); } _ship = new Ship(new Point(50, 300), new Point(0, 7), new Size(70, 30), "ship.jpg"); }