private void ResetGame() { GameObjects.Clear(); _borderBlocks = new EnemyObject[17]; for (int i = 0; i < 17; ++i) { _borderBlocks[i] = new EnemyObject(this, Textures["_borderBlocksGraphics"], 62 * i + 800, _copter, _speed); GameObjects.Add(_borderBlocks[i]); } _midBlock = new MidEnemyObject(this, Textures["_midBlocksGraphics"], 850, _copter, _speed); _midBlock2 = new MidEnemyObject(this, Textures["_midBlocksGraphics"], 850 + 600, _copter, _speed); GameObjects.Add(_midBlock); GameObjects.Add(_midBlock2); _copter = new CopterObject(this, Textures["_copterGraphics"], _borderBlocks, _midBlock, _midBlock2); GameObjects.Add(_copter); _smoke = new SmokeObject[20]; for (int i = 0; i < 20; ++i) { _smoke[i] = new SmokeObject(this, Textures["_smokeGraphics"], _copter, -195 + i * 10, _speed); GameObjects.Add(_smoke[i]); } _wings = new WingsObject(this, Textures["_wingsGraphics1"], _copter); GameObjects.Add(_wings); }
//------------------------------------------------------------------------------------- // Class constructors internal WingsObject(Game1 game, Texture2D texture, CopterObject copter) : base(game, Vector2.Zero, texture) { // Store a strongly-typed reference to the game _game = game; _virtualCopter = copter; Height = texture.Height; Width = texture.Width; // Set a random position PositionX = copter.PositionX + copter.Width / 2; PositionY = 1.043f * copter.PositionY; Angle = 1.57F; // Set the origin Origin = new Vector2(texture.Width, texture.Height) / 2; }
//------------------------------------------------------------------------------------- // Class constructors internal MidEnemyObject(Game1 game, Texture2D texture, int init_y, CopterObject cop, int speed) : base(game, Vector2.Zero, texture) { // Store a strongly-typed reference to the game _game = game; cop1 = cop; Height = texture.Height; Width = texture.Width; // Set a random position for X Coordinate betweeen 120 and width of Device PositionX = GameHelper.RandomNext(110 + Width / 2, 370 - Width / 2); PositionY = init_y; // Set the origin Origin = new Vector2(texture.Width, texture.Height) / 2; _yadd = -speed; }
//------------------------------------------------------------------------------------- // Class constructors internal SmokeObject(Game1 game, Texture2D texture, CopterObject cop, float pos, int speed) : base(game, Vector2.Zero, texture) { // Store a strongly-typed reference to the game _game = game; cop1 = cop; Width = texture.Width; Height = texture.Height; // Set a random position PositionX = cop.PositionX + 10; PositionY = pos + 30; // Set the origin Origin = new Vector2(texture.Width, texture.Height) / 2; _yadd = -speed; }
//------------------------------------------------------------------------------------- // Class constructors internal EnemyObject(Game1 game, Texture2D texture, int init_y, CopterObject cop, int speed) : base(game, Vector2.Zero, texture) { // Store a strongly-typed reference to the game cop1 = cop; _game = game; id = (init_y - 800) / 64; // Set a random position for X Coordinate betweeen 120 and width of Device PositionX = 220; PositionY = init_y; Height = texture.Height; Width = texture.Width; // Set the origin Origin = new Vector2(texture.Width, texture.Height) / 2; _yadd = -speed; }