//// Kweku Cush int score=0; float horizon; float octoX=20, octoY=300, octoDX=0, octoDY=0; float birdsX=10, birdsY=100, birdsDX=6, birdsDY=0; float targetX=-20, targetY=-20; int x = 20; int speed=1; boolean debug; // Properties of the octopus. float x1=400, y=300, w=50, h=80; float dx=2, dy=1; int r=200,g=50,b=200; void setup() { //// Set up frame size, etc. size( 800, 800 ); } // void draw() { // Draw the next frame. scene(); octo(); eyes(); } //*void action(){ //octo(); //monster(); /*if( dist( octoX,octoY, monsterX,monsterY ) < 100 ) { background( 0 ); score -= 10; monsterX= width-20; // Move monster to left side, random height. monsterX= random( horizon, height); }*/ // void scene() { //Sky background(255, 5, 93); //Ocean fill(19, 5, 175); noStroke(); rect(-1, 300, 801, 800); fill(0); //Sun fill(247, 224, 10 ); noStroke(); ellipse( frameCount % width , height/9, 60, 60 ); stroke(0); // Restore stroke //Mountain fill(0,72,12); noStroke(); triangle(300, 300, 500, 50, 700, 300); //waves fill(19, 5, 175); noStroke(); //triangle(x, 200, x+30, 180, x+45, 200); triangle(x-10, 300, x-10, 270, x+10, 300); triangle(x+75, 300, x+90, 270, x+125, 300); triangle(x, 300, x+30, 270, x+45, 300); //Moves the waves x=x+speed; if (x>=width || x<=0) { speed=speed*-1; } stroke(0); // Restore stroke //Title Author fill(0); text("Project 3", 200,10); text(" Kweku Cush (10-8-13)", 20,height-20); } ///// void octo() { if (octoX<20 || octoX> width-20) octoDX *= -1; // Bounce if (octoY height-30) octoDY *= -1; octoX += octoDX; octoY += octoDY; // Head noStroke(); fill(141, 0, 193); ellipse(octoX, octoY, 60, 60); rect( octoX-30, octoY, 60, 80 ); line(octoX-30,octoY,octoX-30,200); //Name fill(0); text("Octo", octoX-10,octoY-10); } ///// void eyes() { //eyes fill(255); ellipse( octoX-0, octoY-0, 30,30); fill(0,103,18); ellipse( octoX-0+octoDX*3-random(2), octoY-0+octoDY*3, 10,10); fill(255); if (debug) text( "octoDX is "+octoDX, octoX-0+octoDX*3, octoY-0-50); } //// void keyPressed() { // if (key=='q') { exit(); }else if (key == '+') { octoDX *= 1.1 ; // 10% speedup octoDY *= 1.1 ; } else if (key == '-') { octoDX *= 0.9 ; octoDY *= 0.9 ; } if (key=='@') debug= ! debug; } void mousePressed() { //// Move octo toward mouse-click. if (mouseX>octoX) octoDX= +2; else octoDX= -2; octoDY= (mouseY>octoY) ? octoDX= +2 : 2 ; background( 255 ); }