Reputation:
The "shooter" subclass
class Shooter : Box
{
public bool goleft;
public bool goright;
public Shooter(float startx, float starty)
{
pic = resizeImage (Properties.Resources.shooter, new Size(50,50)); // resize image
goleft = false;
goright = false;
x = startx;
y = starty;
}
And this is the main class from which it inherited the code.
class Box
{
public Image pic;
public float x;
public float y;
public int speed;
public Box()
{
x = 0;
y = 0;
speed = 0;
}
// Image Resizing Code
public static Image resizeImage(Image imgToResize, Size size)
{
return (Image)(new Bitmap(imgToResize, size));
}
// image resizing code
public void Draw(Graphics g)
{
g.DrawImage(pic, x, y);
}
// some code bellow that basically states the borders and hit boxes.
}
So, yeah, I'm just trying to figure out how to animate a gif which is essentially built by a constructor... The shooter shows up, I can move it around but the problem is, is that it's just not spinnin'. Hope you guys can figure it out. Thanks :D
Upvotes: 0
Views: 360
Reputation: 558
Your GIF is not being animated because your Box
class simply doesn't support it.
If you want to animate the image, you can't open it as a Bitmap, you need to get the image data and do the animation manually, or use a PictureBox to display the image. Here's an example of how to do it manually. Note that in order to resize the GIF, you also need to do it frame by frame.
Upvotes: 1