public void OnDeath(PlayingScreen p) { if (IsPlayer) { //addScreen.DeathScreen(); IsTriggeredDeath = true; return; } Nemesis.ModifyResourceValue("xp", MaxExp); var rnd = Rng.Noxt(3); if (rnd == 1) { p.ScreenManager.GetScreen <PlayingScreen>().items.Add(new Usable(UsableType.HealthPot, PlayingScreen.itemSheet) { Position = new Vector2(Position.X + Rng.Noxt(-10, 10), Position.Y + Rng.Noxt(-10, 10)) }); } if (rnd == 2) { p.ScreenManager.GetScreen <PlayingScreen>().items.Add(new Usable(UsableType.ManaPot, PlayingScreen.itemSheet) { Position = new Vector2(Position.X + Rng.Noxt(-10, 10), Position.Y + Rng.Noxt(-10, 10)) }); } IsTriggeredDeath = true; }
public Tile(TileType type, GridSheet sheet) { IsAnimating = false; GSheet = sheet; switch (type) { case TileType.Grass: CurrentColumn = Rng.Noxt(3); CurrentRow = 0; ID = CurrentColumn; break; case TileType.Tree: break; case TileType.Stone: break; case TileType.Bush: break; case TileType.Water: break; } }
public InventorySlot(Item item, GraphicsDevice gd) { Texture2D Texture = new Texture2D(gd, 1, 1); Color[] colorData = { new Color(15, 15, 15, 255) }; Texture.SetData(colorData); box = new Sprite(ScreenManager.boxbox, Color.White); box.Size = new Vector2(64); Item = item; if (item != null) { item.Color = new Color(Rng.Noxt(255), Rng.Noxt(255), Rng.Noxt(255)); } }
public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); player.Update(gameTime, this); loManager.Update(gameTime, this); popManager.Update(gameTime); cam.Position = player.CenterBox; Globals.ScreenPosition = new Vector2(cam.Position.X - (Globals.ScreenWidth / 2), cam.Position.Y - (Globals.ScreenHeight / 2)); if (!player.Exist) { ExitScreen(); } var delta = (float)gameTime.ElapsedGameTime.TotalSeconds; if (Input.s > Input.sO) { cam.Zoom += (float)0.1; Console.WriteLine(cam.Zoom); } if (Input.s < Input.sO) { cam.Zoom -= (float)0.1; Console.WriteLine(cam.Zoom); } if (Input.KeyClick(Keys.Back)) { cam.Reset(); } Input.sO = Input.s; if (Input.KeyClick(Keys.Space)) { items.Clear(); } if (Input.KeyClick(Keys.Enter)) { if (spawnEnemy) { spawnEnemy = false; } else { spawnEnemy = true; } } if (spawnEnemy) { delay += delta; if (delay > 3) { loManager.AddEnemy(new Enemy(goblinSheet, ScreenManager.GraphicsDevice, player) { Position = new Vector2(player.Position.X + Rng.Noxt(-Globals.ScreenWidth / 2, Globals.ScreenWidth / 2), player.Position.Y + Rng.Noxt(-Globals.ScreenHeight / 2, Globals.ScreenHeight / 2)) }); delay -= 1; } } if (Input.KeyHold(Keys.NumPad1)) { items.Add(new Usable(UsableType.HealthPot, itemSheet) { Position = new Vector2(player.Position.X + Rng.Noxt(-Globals.ScreenWidth / 2, Globals.ScreenWidth / 2), player.Position.Y + Rng.Noxt(-Globals.ScreenHeight / 2, Globals.ScreenHeight / 2)) }); } if (Input.KeyHold(Keys.NumPad2)) { items.Add(new Usable(UsableType.ManaPot, itemSheet) { Position = new Vector2(player.Position.X + Rng.Noxt(-Globals.ScreenWidth / 2, Globals.ScreenWidth / 2), player.Position.Y + Rng.Noxt(-Globals.ScreenHeight / 2, Globals.ScreenHeight / 2)) }); } items.RemoveAll(i => !i.Exist); foreach (var i in items) { i.Update(gameTime); if (player.LootRadius.Intersects(i.Rectangle) && !player.inventory.IsFull && i.IsLootable) { i.IsBeingLooted = true; } else if (player.inventory.IsFull) { i.IsBeingLooted = false; } if (i.IsBeingLooted) { i.VacuumLoot(gameTime, i, player.Position, player.inventory); } else { if (i.Speed >= 0f) { i.Speed -= 400f * (float)gameTime.ElapsedGameTime.TotalSeconds; } if (i.Speed < 0) { i.Speed = 0f; } } } }