ok, i understood that now:
Code:
items[items.length-1].copyBG();
i found out, that there is some fault in the class definition (copyBG() doesn´t work)and thought of a way without using a class. The following does at least half of what i want to (i.e. leave a trace first and move further without trace) - but the trace is lost!
Code:
int ex=0;
PImage b;
void setup()
{
size(400,400);
background(255);
framerate(30);
b = new PImage(width,height);
b = get();
smooth();
}
void draw()
{
int timer=frameCount;
if (timer<60)
{
copy(0,0,width,height,0,0,width,height);
}
else if (timer>=60)
{
image (b,0,0);
}
ex++;
ellipse(ex,height/2,10,10);
}
isn´t there any possibility to save the screen at a certain point of time and use this picture as background?
instead of
Code:
b = get();
i´d like to do someting like this:
Code:
b = copy(0,0,width,height,0,0,width,height);
which causes the error "An expression of type "void" is not valid in this context where a value is expected."
i also rewrote the class BG:
Code:
class BG
{
int sx,sy,swidth,sheight,dx,dy,dwidth,dheight;
BG(int ssx,int ssy,int sswidth,int ssheight,int ddx,int ddy,int ddwidth,int ddheight)
{
sx=ssx; sy=ssy; swidth=sswidth; sheight=ssheight; dx=ddx; dy=ddy; dwidth=ddwidth; dheight=ddheight;
}
void copyBG()
{
copy(sx,sy,swidth,sheight,dx,dy,dwidth,dheight);
}
}
, so i should write something (global) like
Code:
BG bg[] = new BG (0,0,width,height,0,0,width,height);
to pass values to the variables inside the class.
BUT:
Semantic Error: The type of the right sub-expression, "Temporary_...$BG", is not assignable to the variable, of type "Temporary_...$BG[]".
Sorry for all these beginner questions!