public AnimatedSprite(string imgKey, int spriteWidth, int spriteHeight, int index, SheetOrientation orientation) : base(imgKey) { this.spriteWidth = spriteWidth; this.spriteHeight = spriteHeight; this.currentIndex = index; this.orientation = orientation; this.destinationRectangle = new Rectangle(0, 0, this.spriteWidth * Settings.PIXEL_RAPIO, this.spriteHeight * Settings.PIXEL_RAPIO); if (this.orientation == SheetOrientation.HORIZONTAL) { this.sourceRectangle = new Rectangle(this.currentIndex * this.spriteWidth, 0, this.spriteWidth, this.spriteHeight); } else { this.sourceRectangle = new Rectangle(0, this.currentIndex * this.spriteHeight, this.spriteWidth, this.spriteHeight); } }
private void Initialize(string imgKey, int spriteWidth, int spriteHeight, int index, SheetOrientation orientation, int x, int y) { this.spriteWidth = spriteWidth; this.spriteHeight = spriteHeight; this.currentIndex = index; this.orientation = orientation; this.destinationRectangle = new Rectangle((x + (int)this.origin.X) * Settings.PIXEL_RATIO, (y + (int)this.origin.Y) * Settings.PIXEL_RATIO, this.spriteWidth * Settings.PIXEL_RATIO, this.spriteHeight * Settings.PIXEL_RATIO); if (this.orientation == SheetOrientation.HORIZONTAL) { this.sourceRectangle = new Rectangle(this.currentIndex * this.spriteWidth, 0, this.spriteWidth, this.spriteHeight); } else { this.sourceRectangle = new Rectangle(0, this.currentIndex * this.spriteHeight, this.spriteWidth, this.spriteHeight); } }
public AnimatedSprite(string imgKey, int spriteWidth, int spriteHeight, int index, SheetOrientation orientation, int x, int y) : base(imgKey) { this.Initialize(imgKey, spriteWidth, spriteHeight, index, orientation, x, y); }