long startTime = Environment.TickCount; //Guarda los milisegundos que lleva en ejecucion el programa private void Form1_Load(object sender, EventArgs e) { Random rnd = new Random(); GameObject world = scene.World;//no lo entiendo { world.AddChild(new SpaceNoise(Properties.Resources.space_noise_all_capas, 3 * 5.5f, 2.00f, false, false)); } world.AddChild(new StarSpawner()); EnemySpawner[] spawners = new EnemySpawner[]//un array que guarda spawners de enemigos { new EnemySpawner(0, 500, new FuncBehavior(x => Math.Sin(x * 10) * 0.9, 175)), new EnemySpawner(11, 500, new FollowPlayerBehavior(200)), new EnemySpawner(29, 500, new FuncBehavior(x => - 0.9 * (2 / Math.PI) * Math.Asin(Math.Sin(Math.PI * x * 3)), 250)), new EnemySpawner(20, 500, new FlockingBehavior(200)), new EnemySpawner(42, 500, new FuncBehavior(x => (Math.Sin(x * 10) + Math.Sin(x * 5)) * 0.5, 275)), new EnemySpawner(63, 500, new FuncBehavior(x => Math.Atan(x * 10 - 5) * -0.5, 200)), new EnemySpawner(54, 500, new FuncBehavior(x => (Math.Sin((x + 1) * 10 + 15) - Math.Sin((x + 1) * 15)) * 0.2 - 0.4, 300)), }; world.AddChildren(spawners); //Añado los elementos del spawner world.AddChild(new EnemySpawnerDirector(spawners)); //añado el spawner en si //Crea el player setea su configuracion y lo agrega al mundo PlayerShip player = new PlayerShip(33); player.CenterY = world.CenterY; player.Left = world.Left + 100; world.AddChild(player); }
private void Form1_Load(object sender, EventArgs e) { Random rnd = new Random(); GameObject world = scene.World; world.AddChild(new StarSpawner()); Universe.RotateShips(); EnemySpawner[] spawners = new EnemySpawner[] { new EnemySpawner(0, 500, new FuncBehavior(x => Math.Sin(x * 10) * 0.9, 175)), new EnemySpawner(11, 500, new FollowPlayerBehavior(200)), new EnemySpawner(29, 500, new FuncBehavior(x => - 0.9 * (2 / Math.PI) * Math.Asin(Math.Sin(Math.PI * x * 3)), 250)), new EnemySpawner(20, 500, new FlockingBehavior(200)), new EnemySpawner(42, 500, new FuncBehavior(x => (Math.Sin(x * 10) + Math.Sin(x * 5)) * 0.5, 275)), new EnemySpawner(63, 500, new FuncBehavior(x => Math.Atan(x * 10 - 5) * -0.5, 200)), new EnemySpawner(54, 500, new FuncBehavior(x => (Math.Sin((x + 1) * 10 + 15) - Math.Sin((x + 1) * 15)) * 0.2 - 0.4, 300)), }; world.AddChildren(spawners); world.AddChild(new EnemySpawnerDirector(spawners)); PlayerShip player = new PlayerShip(33); player.CenterY = world.CenterY; player.Left = world.Left + 100; world.AddChild(player); Universe.Player = player; }
private void Form1_Load(object sender, EventArgs e) { Random rnd = new Random(); GameObject world = scene.World; { var noise = new[] { Properties.Resources.space_noise_1, Properties.Resources.space_noise_2, Properties.Resources.space_noise_3 }; world.AddChild(new SpaceNoise(noise[0], 3 * 1.5f, 1.00f, false, false)); world.AddChild(new SpaceNoise(noise[0], 3 * 2.5f, 2.00f, true, true)); world.AddChild(new SpaceNoise(noise[1], 3 * 3.5f, 1.50f, false, true)); world.AddChild(new SpaceNoise(noise[2], 3 * 5.5f, 2.00f, true, false)); } world.AddChild(new StarSpawner()); EnemySpawner[] spawners = new EnemySpawner[] { new EnemySpawner(0, 500, new FuncBehavior(x => Math.Sin(x * 10) * 0.9, 175)), new EnemySpawner(11, 500, new FollowPlayerBehavior(200)), new EnemySpawner(29, 500, new FuncBehavior(x => - 0.9 * (2 / Math.PI) * Math.Asin(Math.Sin(Math.PI * x * 3)), 250)), new EnemySpawner(20, 500, new FlockingBehavior(200)), new EnemySpawner(42, 500, new FuncBehavior(x => (Math.Sin(x * 10) + Math.Sin(x * 5)) * 0.5, 275)), new EnemySpawner(63, 500, new FuncBehavior(x => Math.Atan(x * 10 - 5) * -0.5, 200)), new EnemySpawner(54, 500, new FuncBehavior(x => (Math.Sin((x + 1) * 10 + 15) - Math.Sin((x + 1) * 15)) * 0.2 - 0.4, 300)), }; world.AddChildren(spawners); world.AddChild(new EnemySpawnerDirector(spawners)); PlayerShip player = new PlayerShip(33); player.CenterY = world.CenterY; player.Left = world.Left + 100; world.AddChild(player); }