A magic sprite is a texture with a fix position on the screen, beeing drawn in the right spot depending on the current solution. It is not affected by the camera.
Example #1
0
        protected override void LoadContent()
        {
            _dummyTexture = new Texture2D(GraphicsDevice, 1, 1);
            _dummyTexture.SetData(new Color[] { Color.White });

            _normalKey = new MagicSprite(Game1.Instance.SpriteBatch, Game.Content.Load<Texture2D>("sprite/normal_key"), _key1Pos, _keyWidth, null, -1);
            _masterKey = new MagicSprite(Game1.Instance.SpriteBatch, Game.Content.Load<Texture2D>("sprite/normal_key"), _key2Pos, _keyWidth, null, -1);

            _keyFont = Game.Content.Load<SpriteFont>("font/keyFont");
        }
Example #2
0
        public InventoryDrawer(Inventory inventory)
        {
            _inventory = inventory;

            _itemCross = new MagicSprite(Game1.Instance.SpriteBatch, Game1.Instance.Content.Load<Texture2D>("sprite/cross"), _crossPos, null, .5f);

            float panning = .36f;
            _slotPos1 = new Vector2(_itemCross.Center.X, _itemCross.Center.Y - _itemCross.Height * panning);
            _slotPos2 = new Vector2(_itemCross.Center.X + _itemCross.Width * panning, _itemCross.Center.Y);
            _slotPos3 = new Vector2(_itemCross.Center.X, _itemCross.Center.Y + _itemCross.Height * panning);
            _slotPos4 = new Vector2(_itemCross.Center.X - _itemCross.Width * panning, _itemCross.Center.Y);

            _selector = new MagicSprite(Game1.Instance.SpriteBatch, Game1.Instance.Content.Load<Texture2D>("sprite/selector"), Vector2.Zero, panning * .4f, null);
            _selector.Position = _slotPos4;

            _potionBag = new MagicSprite(Game1.Instance.SpriteBatch, Game1.Instance.Content.Load<Texture2D>("sprite/potion"), Vector2.Zero, panning * .3f, null);
            _potionBag.Position = _slotPos4;
            _telekinesis = new MagicSprite(Game1.Instance.SpriteBatch, Game1.Instance.Content.Load<Texture2D>("sprite/telekinesis"), Vector2.Zero, panning * .3f, null);
            _telekinesis.Position = _slotPos2;
            _gun = new MagicSprite(Game1.Instance.SpriteBatch, Game1.Instance.Content.Load<Texture2D>("sprite/gun"), Vector2.Zero, panning * .5f, null);
            _gun.Position = _slotPos1;
            _iceHammer = new MagicSprite(Game1.Instance.SpriteBatch, Game1.Instance.Content.Load<Texture2D>("sprite/ice"), Vector2.Zero, panning * .3f, null);
            _iceHammer.Position = _slotPos3;
        }