Ejemplo n.º 1
0
 public Pickup(int row, int col, Vector2 drawLocation, string pickupName)
 {
     PickupName = pickupName;
     _sprite = new Sprite(pickupName, true);
     Active = true;
     Row = row;
     Col = col;
     Position = drawLocation;
 }
Ejemplo n.º 2
0
        float _walkAcceleration; //how much unit can accelerate when moving (px/sec^2)

        #endregion Fields

        #region Constructors

        public Unit(string key, Vector2 position, bool facingRight)
        {
            UnitData data = UnitDataDict[key];
            _position = position;
            _velocity = Vector2.Zero;
            _walkAcceleration = data.WalkAcceleration;
            _maxSpeed = data.MaxSpeed;
            _jumpSpeed = data.JumpSpeed;
            _hitRect = new Rectangle(
                (int)(position.X - data.HitRectWidth / 2.0f),
                (int)(position.Y - data.HitRectHeight / 2.0f),
                data.HitRectWidth, data.HitRectHeight);
            _sprite = new Sprite(key, facingRight);  //sprite key should match unit key
        }