Пример #1
0
        public Player(Vector2 Location, Texture2D Texture, int MaxShield, int MaxHull, int NumberOfLives)
        {
            v2Location = Location;

            t2dTexture = Texture;
            rectHitBox.Width = Texture.Width;
            rectHitBox.Height = Texture.Height;

            iMaxShield = MaxShield;
            iShield = MaxShield;

            iMaxHull = MaxHull;
            iHull = MaxHull;

            iLives = NumberOfLives;
            bAlive = true;
            healthBar = new HealthBar(new Rectangle(0, 0, 100, 20), MaxShield, MaxShield, MaxHull, MaxHull, true);
        }
Пример #2
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
            defaultTexture = Content.Load<Texture2D>(@"Textures\EnemyBullet");
            scrollingFont = Content.Load<SpriteFont>(@"Fonts\Kootenay");
            defaultFont = Content.Load<SpriteFont>(@"Fonts\Pericles");

            t2dMissleTexture = new Texture2D(GraphicsDevice, 12, 3);
            uint[] iMissileTexture = new uint[12 * 3];
            for (int i = 0; i < iMissileTexture.Length; i++)
                iMissileTexture[i] = 0xFFFFFF00;

            t2dMissleTexture.SetData<uint>(iMissileTexture);

            t2dStarDisplay = new Texture2D(GraphicsDevice, 1, 1);
            t2dStarDisplay.SetData(new Color[] { Color.White });

            rectBackground = new Rectangle()
            {
                Width = graphics.PreferredBackBufferWidth,
                Height = graphics.PreferredBackBufferHeight,
                X = 0,
                Y = 0
            };

            background = new Background(150, rectBackground, t2dStarDisplay);

            Texture2D t2dHealthBar = new Texture2D(GraphicsDevice, 1, 1);
            t2dHealthBar.SetData(new Color[] { Color.White });

            HealthBar healthBarInitialiser = new HealthBar(new Rectangle(0, 0, 0, 0), 0, 0, 0, 0);
            healthBarInitialiser.Initialise(t2dHealthBar, t2dHealthBar, t2dHealthBar, t2dHealthBar);
        }