We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Frame updating / not adding [newbie]
Page Index Toggle Pages: 1
Frame updating / not adding [newbie] (Read 235 times)
Frame updating / not adding [newbie]
Jun 8th, 2009, 10:59am
 
Hi everyone,

I'm trying to create a stickman skeleton. So far I've written a "foot" object that follows the mouse cursor. The problem is that, instead of moving the foot, I get many many copies of it, like a drawing of my cursor path.

I don't know if I have to end the draw function with a kind of erase function or if my syntax is bad. The only thing I'm sure of is that this is a newbie question :o)

Here is the code :

Code:

Foot pied;

void setup() {
size(640, 360);
pied = new Foot(color(0,0,0), width/2, height-1);
}

void draw() {
background: 255;
pied.display(mouseX, mouseY);
}



class Foot {
color c;
int positionX;
int positionY;
int rotation;
 
Foot(color c, int tpositionX, int tpositionY) {
c = 0;
positionX = tpositionX;
positionY = tpositionY;
rotation = 0;
}
 
void display(int tpositionX, int tpositionY) {
stroke(c);
line(tpositionX, tpositionY, tpositionX+20, tpositionY);
}
}
 


Thank you for taking the time to read this!
Re: Frame updating / not adding [newbie]
Reply #1 - Jun 8th, 2009, 11:06am
 
The problem is that your "background" statement is written incorrectly.  Try replacing it with:

background(255);
Re: Frame updating / not adding [newbie]
Reply #2 - Jun 8th, 2009, 11:09am
 
What a shame  Roll Eyes

Thanks Scott!
Page Index Toggle Pages: 1