Exemplo n.º 1
0
using Color = Microsoft.Xna.Framework.Color;
#endregion
namespace ScratchyXna
{
    public class PlayScreen : Scene
    {
        public enum PlayScreenModes
        {
            Init,
            ShowingPlayerNumber,
            Playing,
            Finished
        }
Exemplo n.º 2
0
        /// <summary>
        /// Load the screen
        /// </summary>
        public override void Load()
        {
            BackgroundColor = Color.Black;
            FontName        = "QuartzMS";
            AddSound("shoot");
            AddSound("ufo");
            AddSound("UfoDeath");
            AddSound("AlienDeath");
            AddSound("AlienMove1");
            AddSound("AlienMove2");
            AddSound("AlienMove3");
            AddSound("AlienMove4");

            // Create our sprites
            ship     = AddSprite <ShipSprite>();
            barrier1 = AddSprite <BarrierSprite>();
            barrier2 = AddSprite <BarrierSprite>();
            barrier3 = AddSprite <BarrierSprite>();
            barrier4 = AddSprite <BarrierSprite>();
            missile  = AddSprite <MissileSprite>();
            ufo      = AddSprite <UfoSprite>();
            //line = AddSprite<LineSprite>();

            // Position the barriers
            barrier1.X = -60;
            barrier2.X = -20;
            barrier3.X = 20;
            barrier4.X = 60;

            // Create our texts
            Player1ScoreText = AddText(new Text
            {
                Alignment     = HorizontalAlignments.Left,
                VerticalAlign = VerticalAlignments.Top,
                Scale         = 0.4f,
                Position      = new Vector2(-100f, 100f),
                Color         = Color.White,
                Value         = "Player 1 Score: " + SpaceInvaders.Player1Score
            });

            Player2ScoreText = AddText(new Text
            {
                Alignment     = HorizontalAlignments.Right,
                VerticalAlign = VerticalAlignments.Top,
                Scale         = 0.4f,
                Position      = new Vector2(100f, 100f),
                Color         = Color.White,
                Value         = "Player 2 Score: " + SpaceInvaders.Player2Score
            });

            HighScoreText = AddText(new Text
            {
                Alignment     = HorizontalAlignments.Center,
                VerticalAlign = VerticalAlignments.Top,
                Scale         = .4f,
                Position      = new Vector2(0, 100f),
                Color         = Color.White
            });

            PlayerNumberText = AddText(new Text
            {
                Alignment     = HorizontalAlignments.Center,
                VerticalAlign = VerticalAlignments.Center,
                Scale         = 1f,
                Position      = new Vector2(0, 0),
                Color         = Color.Lime,
                Visible       = false
            });

            LevelText = AddText(new Text
            {
                Alignment     = HorizontalAlignments.Right,
                VerticalAlign = VerticalAlignments.Bottom,
                Scale         = .4f,
                Position      = new Vector2(100f, -100f),
                Color         = Color.White
            });

            shipStatusText = AddText(new Text
            {
                Alignment     = HorizontalAlignments.Left,
                VerticalAlign = VerticalAlignments.Bottom,
                Scale         = 0.5f,
                Position      = new Vector2(-100f, -100f),
                Color         = new Color(1.0f, .2f, .9f, .5f)
            });

            DebugText = AddText(new Text
            {
                Alignment     = HorizontalAlignments.Right,
                VerticalAlign = VerticalAlignments.Top,
                Scale         = 0.4f,
                Position      = new Vector2(100f, 100f),
                Color         = Color.YellowGreen
            });

            LivesText = AddText(new Text
            {
                Alignment     = HorizontalAlignments.Left,
                VerticalAlign = VerticalAlignments.Bottom,
                Scale         = .4f,
                Position      = new Vector2(-100f, -100f),
                Color         = Color.White,
                Value         = "Lives: "
            });
        }