public override void DoCollision(Screen s, Player p, Vector2 playerPos) { if (KVMA_Keyboard.ActionKey()) { Game1.PushScreen(new DialogScreen(s, StringUtil.RandomFortune())); } }
public override void Render(SpriteBatch sb) { drawTicks++; if (drawTicks > maxDrawTicks) { drawTicks = 0; charsToDraw++; } parent.Render(sb); int charsleft = charsToDraw; for (int i = 0; i < text.Length; i++) { RenderString(sb, i, charsleft); charsleft -= text[i].Length; } if (charsToDraw > totalChars()) { sb.DrawString(AssMan.victorianSmall, "Press enter to continue...", new Vector2(1000, 0), Color.White); if (KVMA_Keyboard.SemiAuto(Keys.Enter)) { Game1.PopScreen(); } } }
public override void DoCollision(Screen parent, Player p, Vector2 playerPos) { if (alive) { if (p.GetItem() == Item.Matchbox) { activityString = "Torch"; if (KVMA_Keyboard.ActionKey()) { alive = false; selectedAnim = 1; activityString = ""; } } else if (!readAlready && !armed) { if (KVMA_Keyboard.ActionKey()) { activityString = ""; readAlready = true; Game1.PushScreen(new DialogScreen(parent, StringUtil.RandomGameFortune())); } } } }
public override void Update() { if (KVMA_Keyboard.SemiAuto(Keys.Enter)) { HouseScreen.bodyAsset = IAsset.Sun; Game1.PushScreen(new HouseScreen()); } }
public override void DoCollision(Screen s, Player p, Vector2 playerPos) { if (!armed) { activityString = "Speak"; if (KVMA_Keyboard.ActionKey()) { Game1.PushScreen(new DialogScreen(s, StringUtil.RandomMother())); } } }
public override void DoCollision(Screen s, Player p, Vector2 playerPos) { if (!readAlready) { if (KVMA_Keyboard.ActionKey()) { readAlready = true; activityString = ""; Game1.PushScreen(new DialogScreen(s, StringUtil.NextLore())); } } }
public override void DoCollision(Screen s, Player p, Vector2 playerPos) { if (armed && !eaten) { activityString = "Eat"; if (KVMA_Keyboard.ActionKey()) { eaten = true; p.Eat(); selectedAnim = 0; } } }
public override void DoCollision(Screen s, Player p, Vector2 playerPos) { if (p.GetItem() == Item.Goat) { activityString = "Defenestrate"; if (KVMA_Keyboard.ActionKey()) { AssMan.Get(SAsset.Crunch).Play(); canFire = false; selectedAnim = 1; } } }
public override void DoCollision(Screen s, Player p, Vector2 playerPos) { if (p.GetItem() == Item.Plunger) { activityString = "Clog"; if (KVMA_Keyboard.ActionKey()) { canFire = false; p.PickUpItem(held); selectedAnim = 1; } } }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // Allows the game to exit if (Keyboard.GetState().IsKeyDown(Keys.Escape)) { this.Exit(); } KVMA_Keyboard.Flip(); KVMA_Mouse.Flip(); Peek().Update(); base.Update(gameTime); }
public override void DoCollision(Screen s, Player p, Vector2 playerPos) { if (canFire) { if (p.GetItem() == Item.Mop) { activityString = "Poke"; } if (KVMA_Keyboard.ActionKey()) { canFire = false; activityString = ""; } } }
public override void DoCollision(Screen s, Player p, Vector2 playerPos) { if (KVMA_Keyboard.ActionKey()) { Item putter = p.PickUpItem(held); held = putter; if (held != Item.None) { activityString = "Take " + held.ToString(); } else { activityString = ""; } } }
public void Update(Screen masterScreen, Player p) { if (p.alive && p.GetState() != PlayerState.Eating) { bool moved = false; if (KVMA_Keyboard.UpKey()) { SetPlayerPosition(Util.MoveDirection(playerPosition, Direction.N, Player.speed)); if (InCollisionBoxes(playerPosition) || OutOfBounds(playerPosition)) { SetPlayerPosition(Util.MoveDirection(playerPosition, Direction.S, Player.speed)); } moved = true; p.SetState(PlayerState.WalkNorth); } if (KVMA_Keyboard.DownKey()) { SetPlayerPosition(Util.MoveDirection(playerPosition, Direction.S, Player.speed)); if (InCollisionBoxes(playerPosition) || OutOfBounds(playerPosition)) { SetPlayerPosition(Util.MoveDirection(playerPosition, Direction.N, Player.speed)); } moved = true; p.SetState(PlayerState.WalkSouth); } if (KVMA_Keyboard.LeftKey()) { SetPlayerPosition(Util.MoveDirection(playerPosition, Direction.W, Player.speed)); if (InCollisionBoxes(playerPosition) || OutOfBounds(playerPosition)) { SetPlayerPosition(Util.MoveDirection(playerPosition, Direction.E, Player.speed)); } moved = true; p.SetState(PlayerState.WalkWest); } if (KVMA_Keyboard.RightKey()) { SetPlayerPosition(Util.MoveDirection(playerPosition, Direction.E, Player.speed)); if (InCollisionBoxes(playerPosition) || OutOfBounds(playerPosition)) { SetPlayerPosition(Util.MoveDirection(playerPosition, Direction.W, Player.speed)); } moved = true; p.SetState(PlayerState.WalkEast); } if (!moved) { p.SetState(PlayerState.Idle); } } List <Entity> newEntities = new List <Entity>(); List <int> deadEnts = new List <int>(); for (int i = 0; i < entities.Count; i++) { if (!entities[i].Update(newEntities, p, playerPosition)) { deadEnts.Add(i); } if (entities[i].InRange(playerPosition)) { entities[i].DoCollision(masterScreen, p, playerPosition); } } Entity[] ents = entities.ToArray(); foreach (int i in deadEnts) { ents[i] = null; } entities.Clear(); for (int i = 0; i < ents.Length; i++) { if (ents[i] != null) { entities.Add(ents[i]); } } foreach (Entity e in newEntities) { entities.Add(e); } }