/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { base.Initialize(); // Setup the World worldElements = new List<Block>(); CreateWorld(); // Setup Entities liveEntities = new List<Entity>(); Player = new Entity(playerSprite); Player.Position = new Vector2(200, 200); Player.MovementState = Entity.EntityMovementState.Falling; liveEntities.Add(Player); uiElementList = new List<IUserInterfaceElement>(); playerSpeed = CreateSlider(); playerSpeed.Position = new Point(600, 400); playerSpeed.Initialize(); playerSpeed.Value = (int)Player.Speed.X; uiElementList.Add(playerSpeed); jumpSpeed = CreateSlider(); jumpSpeed.Position = new Point(600, 432); jumpSpeed.Initialize(); uiElementList.Add(jumpSpeed); remainingSpawnTime = 5000; IsMouseVisible = true; IsPaused = false; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { base.Initialize(); liveEntities = new List<Entity>(); Player = new Entity(playerSprite); Player.Position = new Vector2(200, 200); liveEntities.Add(Player); uiElementList = new List<IUserInterfaceElement>(); playerSpeed = CreateSlider(); playerSpeed.Position = new Point(600, 400); playerSpeed.Initialize(); uiElementList.Add(playerSpeed); fireRate = CreateSlider(); fireRate.Position = new Point(600, 432); fireRate.Initialize(); uiElementList.Add(fireRate); remainingSpawnTime = 5000; IsMouseVisible = true; IsPaused = false; }
protected Slider CreateSlider() { Slider s = new Slider(); s.UpSprite = upSprite; s.DownSprite = downSprite; #if WINDOWS || XBOX s.SliderFont = sliderFont; #endif // WINDOWS || XBOX return s; }
protected Slider CreateSlider() { Slider s = new Slider(); s.UpSprite = upSprite; s.DownSprite = downSprite; s.SliderFont = sliderFont; return s; }