コード例 #1
0
 protected override void LoadScreenContent(ContentManager content)
 {
     background = new Background(content, "Images/TitleBackground");
     optionsText = content.Load<Texture2D>("Images/OptionsText");
     fullscreenButton = new Button(content, "Full Screen", new Vector2(ScreenWidth / 2 - 100, 300), Color.Blue, Color.White);
     backButton = new Button(content, "Back", new Vector2(ScreenWidth / 2 - 100, 500), Color.Blue, Color.White);
 }
コード例 #2
0
 protected override void LoadScreenContent(ContentManager content)
 {
     background = new Background(content, "Images/TitleBackground");
     titleText = content.Load<Texture2D>("Images/TitleText");
     gameButton = new Button(content, "Game", new Vector2(ScreenWidth / 2 - 100, 400), Color.Blue, Color.White);
     optionsButton = new Button(content, "Options", new Vector2(ScreenWidth / 2 - 100, 475), Color.Blue, Color.White);
     exitButton = new Button(content, "Exit", new Vector2(ScreenWidth / 2 - 100, 550), Color.Blue, Color.White);
 }
コード例 #3
0
 public bool CheckMousePress(Button button)
 {
     if (CurrentMouseState.LeftButton == ButtonState.Pressed)
     {
         if (CurrentMouseState.X <= button.Position.X + button.Width &&
             CurrentMouseState.X >= button.Position.X &&
             CurrentMouseState.Y <= button.Position.Y + button.Height &&
             CurrentMouseState.Y >= button.Position.Y)
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     else
     {
         return false;
     }
 }
コード例 #4
0
        protected override void LoadScreenContent(ContentManager content)
        {
            background = new Background(content, "Images/GameplayBackground");
            map = new Map[7];
            map[0] = content.Load<Map>("Maps/map01");
            map[1] = content.Load<Map>("Maps/map02");
            map[2] = content.Load<Map>("Maps/map03");
            map[3] = content.Load<Map>("Maps/map04");
            map[4] = content.Load<Map>("Maps/map05");
            map[5] = content.Load<Map>("Maps/map06");
            map[6] = content.Load<Map>("Maps/map07");
            player = new Player(content);
            player.TilePosition = new Vector2(1, 17);
            hud = new HUD(content, player);
            mapNumber = 0;
            leftButton = new Button(content, "", new Vector2(800, 650), Color.White, Color.White, "Images/LeftButton");
            rightButton = new Button(content, "", new Vector2(900, 650), Color.White, Color.White, "Images/RightButton");
            upButton = new Button(content, "", new Vector2(850, 595), Color.White, Color.White, "Images/UpButton");
            downButton = new Button(content, "", new Vector2(850, 705), Color.White, Color.White, "Images/DownButton");

            copyTileLayer = map[mapNumber].GetLayer("Layer") as TileLayer;
            tileLayer = copyTileLayer;
            blankTile = tileLayer.Tiles[19, 0];
            walkableTile = tileLayer.Tiles[19, 1];
            enemyTile = tileLayer.Tiles[19, 2];
            exitTile = tileLayer.Tiles[19, 3];
            enemykilledTile = tileLayer.Tiles[19, 4];

            for (int y = 0; y < tileLayer.Height; y++)
            {
                for (int x = 0; x < 19; x++)
                {
                    if (tileLayer.Tiles[x, y] == enemykilledTile)
                    {
                        tileLayer.Tiles[x, y] = enemyTile;
                    }
                }
            }
            attackButton = new Button(content, "Attack", new Vector2(ScreenWidth / 2 + 220, 250), Color.Blue, Color.White);
            magicButton = new Button(content, "Magic", new Vector2(ScreenWidth / 2 + 220, 325), Color.Blue, Color.White);
            potionButton = new Button(content, "Potion", new Vector2(ScreenWidth / 2 + 220, 400), Color.Blue, Color.White);
            minion = new Minion(content);
            boss = new Boss(content);
            inBattle = false;
            bossBattle = false;

            #region Pregame
            playerCreated = false;
            keydown = (char)0;
            enterplayernameText = new Text(content.Load<SpriteFont>("Fonts/buttonFont"), "Enter Characters Name:", new Vector2(350, 200));
            confirmnameButton = new Button(content, "Enter", new Vector2(425, 550), Color.Blue, Color.White);
            textenterbox = content.Load<Texture2D>("Images/TextInputBar");
            playername = new Text(content.Load<SpriteFont>("Fonts/buttonFont"),"", new Vector2(375, 400), Color.Blue);
            charAmt = 0;
            nameComplete = false;
            enteredName = new char[8];
            for (int i = 0; i < enteredName.Length; i++)
            {
                enteredName[i] = ' ';
            }
            chooseclasstext = new Text(content.Load<SpriteFont>("Fonts/buttonFont"), "Choose Characters Class:", new Vector2(340, 200));
            paladinButton = new Button(content, "Paladin", new Vector2(425, 400), Color.Blue, Color.White);
            casterButton = new Button(content, "Caster", new Vector2(425, 500), Color.Blue, Color.White);
            rogueButton = new Button(content, "Rogue", new Vector2(425, 600), Color.Blue, Color.White);
            storyContinueButton = new Button(content, "Continue", new Vector2(800, 700), Color.Blue, Color.White);
            classComplete = false;
            storytexts = new Texture2D[3];
            storyCount = 0;
            storytexts[0] = content.Load<Texture2D>("Images/Storytext1");
            storytexts[1] = content.Load<Texture2D>("Images/Storytext2");
            storytexts[2] = content.Load<Texture2D>("Images/Storytext3");
            #endregion
        }