/// <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() { graphics.PreferredBackBufferHeight = 288; graphics.PreferredBackBufferWidth = 320; graphics.ApplyChanges(); scale = MathHelper.Min(scaleX, scaleY); #region Levels allNPCS = npcs.AllNPCS; allObjects = objects.AllObjects; Levels = new Dictionary <string, Level>(); area1 = new Level("area1", true, allNPCS["area1"]); area2 = new Level("area2", true, allNPCS["area2"]); area3 = new CollectionQuest("area3", false, allNPCS["area3"], allObjects["testQuestObjects"]); area4 = new ShootingQuest("area1", true, new Dictionary <string, NPC>(), allObjects["testShootingObjects"]); area5 = new Level("area4", true, allNPCS["area5"]); Levels.Add("area1", area1); Levels.Add("area2", area2); Levels.Add("area3", area3); Levels.Add("area4", area4); Levels.Add("area5", area5); #endregion player = new Player(new Vector2(41, 108)); base.Initialize(); }
public virtual void Update(GameTime gT, Player p, GamePadState gP, KeyboardState kB, Game1 game, CollectionQuest lvl) { }
public override void Update(GameTime gT, Player p, GamePadState gP, KeyboardState kB, Game1 game, CollectionQuest lvl) { if (!collected) { gP = GamePad.GetState(PlayerIndex.One); kB = Keyboard.GetState(); base.Update(gT, p, gP, kB, game, lvl); #region ButtonPrompt Vector2 vect = base.ObPos - p.PlayerPos; float dist = vect.Length(); if (dist <= 10.0f) { showBut = true; if (gP.Buttons.B == ButtonState.Pressed || kB.IsKeyDown(Keys.B)) { collected = true; lvl.ColCount++; Debug.WriteLine("Collected Items: " + lvl.ColCount); } } else { showBut = false; } #endregion } }