예제 #1
0
        /// <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);

            // TODO: use this.Content to load your game content here

            // load sprite font
            font = Content.Load <SpriteFont>("Arial20");

            gameTextBox   = new TextBox(Content, gameState);
            startingText  = "Never does a star grace this land with a poets light of twinkling mysteries, nor does the sun send to here its rays of warmth and life. This is the Underdark, the secret world beneath the bustling surface of the Forgotten Realms, whose sky is a ceiling of heartless stone and whose walls show the gray blandness of death in the torchlight of the foolish surface-dwellers that stumble here. This is not their world, not the world of light. Most who come here uninvited do not return.";
            mainCharacter = new MainCharacter(Content);

            currentMap = MapBuilder.BuildBaseMap(Content);
            arial6     = Content.Load <SpriteFont>("arial6");


            //backGroundMusic = Content.Load<Song>(@"Sounds/Hero Demise");
            //MediaPlayer.Play(backGroundMusic);
            //MediaPlayer.IsRepeating = true;

            //walkingFX = Content.Load <SoundEffect>(@"soundsMP3/Footsteps/Footstep_Dirt_00");
            // Play that can be manipulated after the fact
            //var instance = walkingFX.CreateInstance();
            //instance.IsLooped = true;
            //instance.Play();
        }
예제 #2
0
        internal static void MoveCharacter(AdventureWorks.MainCharacter.Direction direction, MainCharacter character, TileMap currentMap)
        {
            Point previousPosition = character.GetPosistion();
            int   mapBoundryX      = GameConstants.MapArea.Width / currentMap.tileSize.X / 2;
            int   mapBoundryY      = GameConstants.MapArea.Height / currentMap.tileSize.Y / 2;

            character.Update(direction);

            if (!currentMap.IsPassable(character.GetPosistion()))
            {
                character.SetPosition(previousPosition);
            }

            if (character.GetPosistion().Y >= mapBoundryY && character.GetPosistion().Y <= currentMap.gridSize.Y - mapBoundryY)
            {
                centerCellY = character.GetPosistion().Y;
            }
            if (character.GetPosistion().X >= mapBoundryX && character.GetPosistion().X <= currentMap.gridSize.X - mapBoundryX)
            {
                centerCellX = character.GetPosistion().X;
            }
        }
예제 #3
0
 internal static void Draw(SpriteBatch spriteBatch, MainCharacter character, TileMap currentMap, SpriteFont font)
 {
     currentMap.DrawMap(spriteBatch, centerCellX, centerCellY);
     DrawMapIndex(spriteBatch, currentMap, font);
     character.Draw(spriteBatch, centerCellX, centerCellY);
 }