/****************************************************************************************** * Constructors *****************************************************************************************/ // No parameters public Game() { map = new Map(); wumpus = new Wumpus(); player = new Player(); superbats = new Hazard[]{ new Hazard("superbat"), new Hazard("superbat"), }; pits = new Hazard[] { new Hazard("pit"), new Hazard("pit"), }; // Initialize the game pieces initBoard(); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. _spriteBatch = new SpriteBatch(GraphicsDevice); _hudFont = Content.Load<SpriteFont>("Segoe24"); _wallNorthOpen = Content.Load<Texture2D>("wall-north-open"); _wallNorthSolid = Content.Load<Texture2D>("wall-north-solid"); _wallEastOpen = Content.Load<Texture2D>("wall-east-open"); _wallEastSolid = Content.Load<Texture2D>("wall-east-solid"); _wallSouthOpen = Content.Load<Texture2D>("wall-south-open"); _wallSouthSolid = Content.Load<Texture2D>("wall-south-solid"); _wallWestOpen = Content.Load<Texture2D>("wall-west-open"); _wallWestSolid = Content.Load<Texture2D>("wall-west-solid"); _groundTex = Content.Load<Texture2D>("floor"); var buttonNorthTex = Content.Load<Texture2D>("ui/button_north"); var buttonEastTex = Content.Load<Texture2D>("ui/button_east"); var buttonSouthTex = Content.Load<Texture2D>("ui/button_south"); var buttonWestTex = Content.Load<Texture2D>("ui/button_west"); _buttonNorth = new Button(buttonNorthTex, _screenBounds.Center.X - (buttonNorthTex.Width / 2), 0); _buttonEast = new Button(buttonEastTex, _screenBounds.Center.X + (_wallNorthSolid.Width / 2) - buttonEastTex.Width, _screenBounds.Center.Y - (buttonNorthTex.Height / 2)); _buttonSouth = new Button(buttonSouthTex, _screenBounds.Center.X - (buttonSouthTex.Width / 2), _screenBounds.Bottom - buttonSouthTex.Height); _buttonWest = new Button(buttonWestTex, _screenBounds.Center.X - (_wallNorthSolid.Width / 2), _screenBounds.Center.Y - (buttonWestTex.Height / 2)); // Setup the map. _map = new Map(Environment.TickCount); }
public GameScreen(ContentManager content, Rectangle screenBounds) { _hudFont = content.Load<SpriteFont>("Segoe24"); _wallNorthOpen = content.Load<Texture2D>("wall-north-open"); _wallNorthSolid = content.Load<Texture2D>("wall-north-solid"); _wallEastOpen = content.Load<Texture2D>("wall-east-open"); _wallEastSolid = content.Load<Texture2D>("wall-east-solid"); _wallSouthOpen = content.Load<Texture2D>("wall-south-open"); _wallSouthSolid = content.Load<Texture2D>("wall-south-solid"); _wallWestOpen = content.Load<Texture2D>("wall-west-open"); _wallWestSolid = content.Load<Texture2D>("wall-west-solid"); _groundTex = content.Load<Texture2D>("floor"); _goopTex = content.Load<Texture2D>("alien/goop"); _alienTex = content.Load<Texture2D>("alien/alien"); _trapTex = content.Load<Texture2D>("trap"); _trapWarnTex = content.Load<Texture2D>("ui/beep-beep"); _healthTex = content.Load<Texture2D>("ui/health"); _flamethrowerTex = content.Load<Texture2D>("flamethrower"); _flamesTex = content.Load<Texture2D>("flames"); _gameLossTex = content.Load<Texture2D>("ui/text_gameover"); _gameWinTex = content.Load<Texture2D>("ui/text_alienterminated"); _footstepsSound = content.Load<SoundEffect>("sounds/footsteps"); _trapHurtSound = content.Load<SoundEffect>("sounds/trap_hurt"); _trapNearSound = content.Load<SoundEffect>("sounds/trap_near").CreateInstance(); _alienNearSound = content.Load<SoundEffect>("sounds/alien-near").CreateInstance(); _deathStingSound = content.Load<SoundEffect>("sounds/death-sting"); _playerDeathAlienSound = content.Load<SoundEffect>("sounds/player-death-alien"); _famethrowerStingSound = content.Load<SoundEffect>("sounds/flamethrower-pickup"); _famethrowerSound = content.Load<SoundEffect>("sounds/flamethrower"); _shipAmbienceSound = content.Load<SoundEffect>("sounds/ship-ambience").CreateInstance(); _alienDeathSound = content.Load<SoundEffect>("sounds/alien-death"); { var buttonNorthTex = content.Load<Texture2D>("ui/button_north"); var buttonEastTex = content.Load<Texture2D>("ui/button_east"); var buttonSouthTex = content.Load<Texture2D>("ui/button_south"); var buttonWestTex = content.Load<Texture2D>("ui/button_west"); _buttonNorth = new Button(buttonNorthTex, screenBounds.Center.X - (buttonNorthTex.Width / 2), 0); _buttonEast = new Button(buttonEastTex, screenBounds.Center.X + (_wallNorthSolid.Width / 2) - buttonEastTex.Width, screenBounds.Center.Y - (buttonNorthTex.Height / 2)); _buttonSouth = new Button(buttonSouthTex, screenBounds.Center.X - (buttonSouthTex.Width / 2), screenBounds.Bottom - buttonSouthTex.Height); _buttonWest = new Button(buttonWestTex, screenBounds.Center.X - (_wallNorthSolid.Width / 2), screenBounds.Center.Y - (buttonWestTex.Height / 2)); } { var flameThrowerBtnTex = content.Load<Texture2D>("ui/flamethrower"); _flameThrowerButton = new Button(flameThrowerBtnTex, screenBounds.Right - flameThrowerBtnTex.Width, screenBounds.Bottom - flameThrowerBtnTex.Height); var buttonNorthTex = content.Load<Texture2D>("ui/attack_north"); var buttonEastTex = content.Load<Texture2D>("ui/attack_east"); var buttonSouthTex = content.Load<Texture2D>("ui/attack_south"); var buttonWestTex = content.Load<Texture2D>("ui/attack_west"); _attackButtonNorth = new Button(buttonNorthTex, screenBounds.Center.X - (buttonNorthTex.Width / 2), 0); _attackButtonEast = new Button(buttonEastTex, screenBounds.Center.X + (_wallNorthSolid.Width / 2) - buttonEastTex.Width, screenBounds.Center.Y - (buttonNorthTex.Height / 2)); _attackButtonSouth = new Button(buttonSouthTex, screenBounds.Center.X - (buttonSouthTex.Width / 2), screenBounds.Bottom - buttonSouthTex.Height); _attackButtonWest = new Button(buttonWestTex, screenBounds.Center.X - (_wallNorthSolid.Width / 2), screenBounds.Center.Y - (buttonWestTex.Height / 2)); } // Setup the player. _player = new Player(); // Setup the map. _map = new Map(Environment.TickCount); OnEnterRoom(); }