class Particle { private float gravity = 9.82; private float xpos,ypos; private float xstartpos,ystartpos; private float xvel,yvel; private float xacc,yacc; private float weight; private color col; private int timer ,timers; private boolean alive; private float ystartvel,xstartvel; private String typeString; public Particle(float x,float y,float vx,float vy,color c,float w,int t) { xpos = x; ypos = y; xstartpos=xpos; ystartpos=ypos; col = c; xvel = vx; yvel = vy; ystartvel= vy; xstartvel=vx; xacc=0; yacc=gravity; weight = w; timer = t; timers = t; alive = true; typeString="Partile"; } public void update() {if(timer--!=0){ xpos += xvel; ypos +=yvel; xvel += xacc; yvel +=yacc*weight; } else{ ypos = ystartpos; xpos = xstartpos; xvel = xstartvel; yvel = ystartvel; xacc=0; yacc=gravity; timer = timers; alive = false; } } public int getPosX() { return (int)xpos; } public int getPosY() { return (int)ypos; } public boolean isalive(){ return alive;} public void drawit() {fill(col); ellipse(xpos,ypos,3,3);} public String type() {return typeString;} }