We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I tried to define 'Particle' class.
I don't think I have any problems in my code below. but it kept saying'found one too many characters without a to match it"
My code is like below.
class Particle {
PVector location;
PVector velocity;
PVector acceleration;
float lifespan = 255;
Particle (PVector l) {
acceleration = new PVector(0,0.05);
velocity = new PVector(random(-1,1),random(-1,1));
location = l.get();
}
void update() {
velocity.add(acceleration);
location.add(velocity);
lifespan = lifespan -2;
}
void display() {
stroke(0,lifespan);
strokeWeight(2);
fill(127,lifespan);
ellipse(location.x, location.y, 12, 12);
}
}
Answers
Maybe your sketch is named Particle as well. If so, rename it to something else! L-)
Thank you so much it started to work! But why does the name of tab affect the code?
extends
Processing's PApplet class.Basically, call your sketch something different from your classes.