/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { base.Initialize(); shipThrustOff = Game.Content.Load<Texture2D>(@"Sprites\ShipNoThrust"); shipThrustOn = Game.Content.Load<Texture2D>(@"Sprites\ShipThrust"); fuel = MAX_FUEL; fuelTimerId = Guid.NewGuid(); base.sprite = shipThrustOff; base.position = new Vector2((Game as MainGame).Center.X, 100); base.velocity = Vector2.Zero; base.direction = MathHelper.Pi + MathHelper.PiOver2; base.spriteRotation = MathHelper.Pi; previousKeyState = Keyboard.GetState(); //setup timers for the ship timerService = Game.Services.GetService(typeof(ITimerService)) as ITimerService; timerService.SetTimer(fuelTimerId, FUEL_TIME_EVENT); }