Beispiel #1
0
        /// <summary>
        /// PlayerDisplayData provides a basic text for a player's number and score - "Player 1 - Score: 0"
        /// </summary>
        /// <param name="playerIndex">Which player is this data for?</param>
        /// <param name="fontName">Which font name to use.  You must have a corresponding spritefont in your content project.</param>
        /// <returns>A PlayerDisplayData object with the default configuration.</returns>
        public PlayerScoreDisplay AddPlayerScoreDisplay(PlayerIndex playerIndex, String fontName)
        {
            PlayerScoreDisplay playerScoreDisplay = new PlayerScoreDisplay(this, playerIndex, fontName);

            Components.Add(playerScoreDisplay);
            return(playerScoreDisplay);
        }
Beispiel #2
0
        public override void Setup()
        {
            viewableArea = AddWalls(0,24, "brick");

            AddWizard1();

            display1 = AddPlayerScoreDisplay(PlayerIndex.One, "segoe");
            display1.Position = ScreenHelper.TopLeftQuarter;

            wizard2 = AddFourDirectionPlayer(PlayerIndex.Two, "wizard");
            wizard2.Category = "wizard2";
            wizard2.DisplayPosition = ScreenHelper.CenterRightQuarter;
            wizard2.OverlayColor = Color.Orange;

            display2 = AddPlayerScoreDisplay(PlayerIndex.Two, "segoe");
            display2.Position = ScreenHelper.TopRightQuarter;

            AddMonsters("blob", 2);
            AddMonsters("ghost", 2);
            AddMonsters("ogre", 2);

            AddTimedEvent(3, AddRandomMonster);

            AddRuby();

            AddCollisionHandler("wizard", "ruby", WizardRubyCollision);
            AddBackgroundImage("tile", viewableArea);

            AddInputHandler(PlayerOneFireball, PlayerIndex.One, Keys.RightControl, Buttons.A);
            AddInputHandler(PlayerTwoFireball, PlayerIndex.Two, Keys.LeftControl, Buttons.A);

            AddCollisionHandler("magicball", "brick", FireballBrickCollision);
            AddCollisionHandler("magicball", "monster", FireballMonsterCollision);
            AddCollisionHandler("wizard", "monster", WizardMonsterCollision);
        }
Beispiel #3
0
 /// <summary>
 /// PlayerDisplayData provides a basic text for a player's number and score - "Player 1 - Score: 0"
 /// </summary>
 /// <param name="playerIndex">Which player is this data for?</param>
 /// <param name="fontName">Which font name to use.  You must have a corresponding spritefont in your content project.</param>
 /// <returns>A PlayerDisplayData object with the default configuration.</returns>
 public PlayerScoreDisplay AddPlayerScoreDisplay(PlayerIndex playerIndex, String fontName)
 {
     PlayerScoreDisplay playerScoreDisplay = new PlayerScoreDisplay(this, playerIndex, fontName);
     Components.Add(playerScoreDisplay);
     return playerScoreDisplay;
 }