import gifAnimation.*; int cave[ ] = new int[450]; int flor[ ] = new int[450]; PImage[] animation; Gif loopingGif; boolean pause = false; int imageX = 0; int imageY = width/2; boolean crash = false; int gd =0; int speedX = 0; int speedY = 0; int xl = 70; int yl = 30; float xoff = 0.0; float yoff = 0.0; void setup(){ size(cave.length,250,P2D); imageY = width/2; //println("gifAnimation " + Gif.version()); // create the GifAnimation object for playback loopingGif = new Gif(this, "ship_blue.gif"); loopingGif.loop(); for (int n = 0; n0; n--) { cave[cave.length-1-n]=cave[cave.length-n]; flor[cave.length-1-n]=flor[cave.length-n]; } } xoff = xoff + .01; yoff = yoff + .01; float g = noise(xoff) * height/4; if (crash == true) { g = 1; } speedX = (((mouseX-imageX))/20); speedY = (((mouseY-imageY))/20); imageX += speedX; imageY += speedY; if (crash == true) { imageX=width+600; imageY=height+60; } image(loopingGif, imageX+int(random(-1.5,1.5)), imageY,xl,yl); for (int c = 0; c < cave.length; c++) { stroke(0); line ( c,0, c,(cave[c]+g)-30); line( c,(flor[c]+g)+30,c,height); line( c,(cave[c]+g)-15, c,cave[c]+g); line(c,flor[c]+g, c,(flor[c]+g)+15); stroke(255); line( c,(cave[c]+g)-30, c,(cave[c]+g)-15); line( c,(flor[c]+g)+15,c,(flor[c]+g)+30); } if (crash==true){ xl = 0; yl = 0; fill(255,255,255); stroke(255,255,255); ellipse (imageX+int(random(-1,1)*gd),imageY+int(random(-1,1)*gd)+gd*int(random(-1,1)),int(random(20,50)),int(random(20,50))); gd = gd+1; delay(100); } else{ if (imageY < cave[imageX]+g || imageY+25 > flor[imageX]+g) { //println("bang"); //background(255); for (int go = 0; go<200; go++) { fill(255,255,255,200-go); stroke(255,255,255,200-go); ellipse (imageX+int(random(-1,1)*go),imageY+int(random(-1,1)*go)+go*int(random(-1,1)),int(random(20,50)),int(random(20,50))); //delay(1000); } crash = true; //noLoop(); } } if (mousePressed == true) for ( float gog = 0 ; gog < 30; gog=gog+1) { fill(0,0,50,10); stroke(0,0,250,10) ; ellipse(imageX+84,imageY+12,gog,gog); noFill(); stroke(0,0,250,gog); ellipse(imageX+64,imageY+12,gog-10,gog-10); } } void mousePressed() { stroke(255); for (int u=0 ; u < width + 20 ; u++) { line(imageX+u+50, imageY+12, imageX+70+u,imageY+12); } }