public JewelCart(Vector2 startPosition) : base("spr_jewelcart") { LocalPosition = startPosition; startX = startPosition.X; glitters = new GlitterField(sprite, 40, new Rectangle(275, 470, 430, 85)); glitters.Parent = this; }
/// <summary> /// Creates a new Jewel of a random type. /// </summary> public Jewel() : base("spr_jewels") { ColorType = ExtendedGame.Random.Next(3); ShapeType = ExtendedGame.Random.Next(3); NumberType = ExtendedGame.Random.Next(3); // The sprite is a single sheet that contains all possible jewel sprites. // Calculate the part of that sprite that we want to draw. int index = 9 * ColorType + 3 * ShapeType + NumberType; spriteRectangle = new Rectangle(index * sprite.Height, 0, sprite.Height, sprite.Height); TargetPosition = Vector2.Zero; glitters = new GlitterField(sprite, 2, spriteRectangle); glitters.Parent = this; glitters.LocalPosition = -spriteRectangle.Location.ToVector2(); }