Beispiel #1
0
 public Player(IMap map, Rectangle spawnPos, int id)
     : base(map,spawnPos, id)
 {
     _groupID = 1;
     _speed = Vector2.Zero;
     _onGround = false;
     //_bodyParts = new List<BodyPart>();
     //_bodyParts.Add(_baseBody);
     _collisionOffset = new Vector4((((16 - spawnPos.Width) % 16 + 16) % 16) + 0.6f, 0, (((16 - spawnPos.Height) % 16 + 16) % 16) + 0.99975f, 0.0015f);
     flying = true;
     //_completeBody = new BodyPart();
     _body = new Body.Body(this);
     //CalculateTotalBonus();
     ShadowsOn = true;
     _objectType = 0;
     _body = new Body.Body(this);
     _inventory = new Inventory(this);
 }
Beispiel #2
0
        public Player(IMap map, string CharFile, Rectangle spawnPos, int id)
            : base(map,spawnPos,id)
        {
            _groupID = 1;
            _charFile = CharFile;
            StreamReader reader = new StreamReader("Content\\chars\\" + CharFile + ".chr");
            string fileContent = reader.ReadToEnd();
            reader.Close();
            string[] lines = fileContent.Split(new string[] { "\n", Environment.NewLine }, StringSplitOptions.None);
            int.TryParse(lines[0], out _rect.Width);
            int.TryParse(lines[1], out _rect.Height);
            _position.X -= _rect.Width - 16;
            _position.Y -= _rect.Height - 16;
            int.TryParse(lines[5], out _hp);
            _maxhp = _hp;
            ShadowsOn = true;
            _speed = Vector2.Zero;
            _onGround = false;
            //_bodyParts = new List<BodyPart>();
            //_bodyParts.Add(_baseBody);
            _collisionOffset = new Vector4((((16 - _rect.Width) % 16 + 16) % 16) + 0.6f, 0, (((16 - _rect.Height) % 16 + 16) % 16) + 0.99975f, 0.0015f);
            flying = true;
            //_completeBody = new BodyPart();
            //CalculateTotalBonus();
            _objectType = 0;

            _body = new Body.Body(this);
            _inventory = new Inventory(this);
        }
Beispiel #3
0
 public void EquipAttack(int slot, Body.AttackPart part)
 {
     _body.TryEquip(slot, part);
 }