Hello guys,
I have a problem (or I found a bug). I have this property:
public Rectangle BoundingBox
{
get
{
Rectangle spriteBounds = {
new Rectangle((int)(8* canScale), (int)(3* canScale), (int)(47* canScale), (int)(15* canScale)),
new Rectangle((int)(2* canScale), (int)(18* canScale), (int)(58* canScale), (int)(44* canScale)),
new Rectangle((int)(12* canScale), (int)(60* canScale), (int)(40* canScale), (int)(12* canScale)),
new Rectangle((int)(28* canScale), (int)(70* canScale), (int)(10* canScale), (int)(26* canScale)),
new Rectangle((int)(8* canScale), (int)(95* canScale), (int)(49* canScale), (int)(76* canScale))};
foreach (Rectangle rect in spriteBounds)
** {**
** rect.Offset(canPosition - canOrigin * canScale);**
** }**
return spriteBounds;
}
and the Offset() operation doesn’t work. But, if I try this:
public Rectangle BoundingBox
{
get
{
Rectangle spriteBounds = {
new Rectangle((int)(8* canScale), (int)(3* canScale), (int)(47* canScale), (int)(15* canScale)),
new Rectangle((int)(2* canScale), (int)(18* canScale), (int)(58* canScale), (int)(44* canScale)),
new Rectangle((int)(12* canScale), (int)(60* canScale), (int)(40* canScale), (int)(12* canScale)),
new Rectangle((int)(28* canScale), (int)(70* canScale), (int)(10* canScale), (int)(26* canScale)),
new Rectangle((int)(8* canScale), (int)(95* canScale), (int)(49* canScale), (int)(76* canScale))};
spriteBounds[0].Offset(canPosition - canOrigin * canScale);
** spriteBounds[1].Offset(canPosition - canOrigin * canScale);**
** spriteBounds[2].Offset(canPosition - canOrigin * canScale);**
** spriteBounds[3].Offset(canPosition - canOrigin * canScale);**
** spriteBounds[4].Offset(canPosition - canOrigin * canScale);**
return spriteBounds;
}
}
the Offset() operation works fine.