0

I'm currently working on a project and I'm trying to scale an image down. I have a hitbox determined by the following code.

public Rectangle bound
    {
        get
        {
            return new Rectangle((int)position.X, (int)position.Y, 
                texture.Width * (int)scale.X,
                texture.Height * (int)scale.Y);
        }
    }

This works assuming the scale is either one or greater. However, when I input a scale value less than one collisions don't work and the Console.WriteLine() function returns {X:300 Y:300 Width:0 Height:0}. Is there something I'm doing wrong?

1 Answers1

1

Well don't I feel silly.

public Rectangle bound
    {
        get
        {
            return texture == null ? new Rectangle(0,0,0,0) : new Rectangle((int)position.X, (int)position.Y,
                (int)(texture.Width * scale.X), (int)(texture.Height * scale.Y));
        }
    }

Apparently if your rectangle's dimensions are a float it returns a zero.