Inheritance: Microsoft.Xna.Framework.DrawableGameComponent
Example #1
0
 private Player(Game1 game)
     : base(game, new Vector2(0, 0),  "Player")
 {
     MaxHealth = 80;
     Health = MaxHealth;
     CM.Bang += new EventHandler<BangEventArgs>(OnBang);
     _inventory = new Inventory();
     this.AddModule(new ThinkInputGuided());
     this.AddModule(new Obstacle());
     this.AddModule(new ExplodeAndLoot(null));
     this.CanBeAttacked = true;
 }
Example #2
0
 private Player()
     : base(new Vector2(0, 0),  "Player")
 {
     MaxHealth = 80;
     Health = MaxHealth;
     //DropShadow = true;
     CM.Bang += new EventHandler<BangEventArgs>(OnBang);
     this.AddModule(new ThinkInputGuided());
     this.AddModule(new DamageFlash());
     this.AddModule(new Obstacle());
     this.CollideModule.MovingShape = new Rectangle(-16, -48, 32, 32);
     this.AddModule(new ExplodeAndLoot(Item.Nothing));
     LoadContent();
     _inventory = new Inventory((base._thinkModule as ThinkInputGuided).Swing);
 }
Example #3
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;
        }