protected override void Initialize() { Pixelclass.Content = Content; Actor.Dimentions = new Point(32, 32); Level.m_LayerSize = Actor.Dimentions; m_level = new Level(); m_Player = new Player(); m_input = new InputManager(); m_cam = new Camera(GraphicsDevice.Viewport); base.Initialize(); //m_level.m_mazeGen.GenerateMaze(new MazeInfo(new Point(65, 65), 10, 2, 2, 100)); m_Player.VirtualPosition = m_level.m_StartPos; }
public void UpdateMe(GameTime gt, Level level, InputManager input) { if (input.IsDown(Keys.Left)) MoveHere.X += -1; if (input.IsDown(Keys.Right)) MoveHere.X += 1; if (input.IsDown(Keys.Up)) MoveHere.Y += -1; if (input.IsDown(Keys.Down)) MoveHere.Y += 1; base.UpdateMe(gt, level); }
public void UpdateMe(GameTime gt, InputManager Input) { MapChanged = false; if (Input.WasPressedBack(Keys.H)) { help = !help; } for (int x = 0; x < levelCreate.Map.GetLength(1); x++) { for (int y = 0; y < levelCreate.Map.GetLength(0); y++) { if (Input.ThisMouse.LeftButton == ButtonState.Pressed && new Rectangle(x * Game1.TILESIZE, y * Game1.TILESIZE, Game1.TILESIZE, Game1.TILESIZE).Contains(Input.ThisMouse.Position)) { if (levelCreate.Map[y, x] != 2 && levelCreate.Map[y, x] != 3 && levelCreate.Map[y, x] != 1) { levelCreate.Map[y, x] = 1; MapChanged = true; } } else if (Input.ThisMouse.RightButton == ButtonState.Pressed && new Rectangle(x * Game1.TILESIZE, y * Game1.TILESIZE, Game1.TILESIZE, Game1.TILESIZE).Contains(Input.ThisMouse.Position)) { if (levelCreate.Map[y, x] != 2 && levelCreate.Map[y, x] != 3 && levelCreate.Map[y, x] != 0) { levelCreate.Map[y, x] = 0; MapChanged = true; } } else if (Input.WasPressedBack(Keys.A) && new Rectangle(x * Game1.TILESIZE, y * Game1.TILESIZE, Game1.TILESIZE, Game1.TILESIZE).Contains(Input.ThisMouse.Position)) { if (levelCreate.Map[y, x] == 0) { for (int x2 = 0; x2 < levelCreate.Map.GetLength(1); x2++) for (int y2 = 0; y2 < levelCreate.Map.GetLength(0); y2++) if (levelCreate.Map[y2, x2] == 2) levelCreate.Map[y2, x2] = 0; levelCreate.Map[y, x] = 2; levelCreate.m_StartPos = new Point(y, x); MapChanged = true; } } else if (Input.WasPressedBack(Keys.D) && new Rectangle(x * Game1.TILESIZE, y * Game1.TILESIZE, Game1.TILESIZE, Game1.TILESIZE).Contains(Input.ThisMouse.Position)) { if (levelCreate.Map[y, x] == 0) { for (int x2 = 0; x2 < levelCreate.Map.GetLength(1); x2++) for (int y2 = 0; y2 < levelCreate.Map.GetLength(0); y2++) if (levelCreate.Map[y2, x2] == 3) levelCreate.Map[y2, x2] = 0; levelCreate.Map[y, x] = 3; levelCreate.m_WinPos = new Point(y, x); MapChanged = true; } } } } }
public void UpdateMe(GameTime gt,Player player,InputManager input) { if (input.WasPressedBack(Keys.Enter)) { if (player.VirtualPosition == m_WinPos) { Height++; if (Height % 10 == 0) RegenTown(); else RegenMaze(); player.VirtualPosition = m_StartPos; } else if (player.VirtualPosition == m_StartPos) { Height--; if (Height % 10 == 0) RegenTown(); else RegenMaze(); player.VirtualPosition = m_WinPos; } } if (input.IsDown(Keys.Space)) { Rectangle temprect; temprect = m_mazeGen.m_rooms[Game1.RNG.Next(0, m_mazeGen.m_rooms.Count)]; m_enemies.Add(new Enemy(new Point(temprect.X + Game1.RNG.Next(1, temprect.Width - 1), temprect.Y + Game1.RNG.Next(1, temprect.Height - 1)))); } for (int i = 0; i < m_enemies.Count; i++) m_enemies[i].UpdateMe(gt, this); }