// move the lightning bolt horizontally //declare some variables first float y = 20; float x = 10; int xDir = 1; //setup function void setup() { size(400,200); } //draw function where the action happens void draw() { background(0); smooth(); noStroke(); fill(250,230,5); beginShape(); vertex(x,y); vertex(x,y+50); vertex(x+10,y+40); vertex(x,y+100); vertex(x+10,y+90); vertex(x,y+160); vertex(x+40,y+65); vertex(x+30,y+75); vertex(x+40,y+25); vertex(x+30,y+35); vertex(x+40,y); endShape(CLOSE); //increment the value of x by 1 each time the program loops through draw() x=x+0.5*xDir; if (x>width || x<0){ xDir=xDir*-1; } }