I'm trying to make the first level in Super Mario bros and I'm increasing the xstart which is the start of the image with constant rate as Mario moves right but the problem is every time Mario keeps moving faster than the image and his image width increases.
Here is the draw of the Bitmap
g.DrawImage(im,
new Rectangle(0, 0, this.Width, this.Height), //dest.
new Rectangle(xstart, 0, this.Width, this.Height), //src.
GraphicsUnit.Pixel);
and I always increase the xstart with the movement of Mario and I can't see any problem in here..
player.x += 5;
xstart += 5;
My guess is that you have to read https://msdn.microsoft.com/en-us/library/ms142040(v=vs.110).aspx
You seem to mess with the parameters.
Maybe you are looking for something like :
g.DrawImage(im, new Rectangle(xstart, 0, xstart + im.Width, im.Height), //dest area in win. new Rectangle(0, 0, im.Width, im.Height), //All the input img. GraphicsUnit.Pixel);