Remnants on movement and picture off-screening

This may be a stupid question but if you import a paint file with a character (rectangle) that moves on the screen is there any better way to clear the remnants left behind by the old copy of the character except just redrawing over it.

Also is there a way for you to have a 700x700 paint file and put it onto a 500x500 screen but the excess 200x200 go off the screen so the character (rectangle) can move and reveal more of the image?

Hi,

Here I think you are talking about drawing a background at each frame so it’s clearing the previous “character” drawn on the screen? By the way what do you call a paint file? Is it an image?

Can you be more explicit on the last question? If it’s what I am thinking, if you import an image that is wider than the actual size of your canvas, the excess is not going to disepear so that’s fine.

1 Like

In this way @FlyingApple can you pass your code make understanble your problem.

So there is an external image file (paint file if it matters) which is 500x500.

void setup()
{
  size(700, 700);
  image = requestImage("levelDetail.png");
}

void draw()
{

  image(image, 0, 0, width, height);
}

The same thing appears but larger if i do size(700,700).

I want the size of the image to stay 500x500 but the remaining pixel space is left blank.

Sorry idk how to format code.Preformatted text

1 Like

try:

image(image,0,0);

but you see, image is a function, so i not like you name your picture “image” how about “img”


in the forum editor is a headerline with some symbols,
to post code pls. use

</> code tag

and PASTE you ( in IDE formatted [ctrl][t] ) code into

1 Like

Thanks for the answer to the question and thanks to how to do the format

Call it a png file – MSPaint can save different kinds of files, and different versions of paint have different default file formats, so that is ambiguous, like “house pet” (so dog? cat?).

Clearing with background and redrawing is usually the best way.

Yes. Use translate(). See recent discussions:

One important thing – don’t draw your character and background onto one image! Draw your character on one image, draw your background on another, import them both.