final int TIMEBAR_TOP = SCREENSIZE*9/10; final int TIMEBAR_HEIGHT = SCREENSIZE/20; final int TIMEBAR_MAXWIDTH = SCREENSIZE / 4; final int TIMEBAR_LEFT = (SCREENSIZE - TIMEBAR_MAXWIDTH) / 2; final int ARROW_TOP = SCREENSIZE*9/10; final float ARROW_SIZE = 20; final float ARROW_DIST_FROM_WALL = SCREENSIZE/10; void guiAtSetup(){ imgArrowCW = loadImage("arrowcw.png"); imgArrowCCW = loadImage("arrowccw.png"); textFont(loadFont( "ArialNarrow-24.vlw")); } void drawFinalScore(){ textAlign(CENTER); fill(255); text("Thank You for your help in saving the Alien Lifeforms!", SCREENSIZE/2,SCREENSIZE/2-40); text("You scored "+lifepoints + " Lifepoints!", SCREENSIZE/2 ,SCREENSIZE/2); text("You saved "+(numberBorn-numberKilled)+" Lifeforms!", SCREENSIZE/2 ,SCREENSIZE/2+40);// out of "+numberBorn,40,SCREENSIZE/2+40); text("Press SpaceBar to Try Again!",SCREENSIZE/2,SCREENSIZE/2+100 ); textAlign(LEFT); } void doGUI(){ drawTimeBar(); drawArrows(); drawScore(); drawTimeRemaining(); drawGuysLeft(); } void drawTimeRemaining(){ String txt = "Lifepoints:"+lifepoints; strokeWeight(2); stroke(20,100,20); fill(80,180,80); rect(20,2,textWidth(txt),26); fill(0); text(txt,20,22);//+" chance is 1 in "+chance,0,20); } void drawGuysLeft(){ String txt = "Lifeforms in Ship:"+guys.size(); strokeWeight(2); stroke(20,100,20); fill(80,180,80); rect(180,2,textWidth(txt),26); fill(0); text(txt,180,22);//+" chance is 1 in "+chance,0,20); } void drawScore(){ float timeGone = GAMELASTS - (framecount / FPS); int seconds = int(timeGone) % 60; int minutes = int(timeGone / 60); String showseconds = ""+seconds; if(showseconds.length() == 1){ showseconds = "0"+showseconds; } String txt = "Time Remaining: "+minutes+":"+showseconds; strokeWeight(2); if(timeGone > 10){ stroke(20,100,20); fill(80,180,80); } else { stroke(100,20,20); fill(180,80,80); } rect(400,2,textWidth(txt),26); fill(0); text(txt,400,22);//+" chance is 1 in "+chance,0,20); } void drawTimeBar(){ float framesLeft = FRAMESPERROUND - (framecount % FRAMESPERROUND); float fracRemain = framesLeft /FRAMESPERROUND; // println(fracRemain); fill(200,200,255,255-(255*fracRemain)); stroke(0); strokeWeight(2); float barWidth = TIMEBAR_MAXWIDTH * fracRemain; float barLeft = 0; if( nextTurn == NOTURN){ barLeft = (SCREENSIZE/2)-(barWidth/2); } if( nextTurn == TURNCCW){ barLeft = ARROW_DIST_FROM_WALL;//+ARROW_SIZE; } if( nextTurn == TURNCW){ barLeft = SCREENSIZE - ARROW_DIST_FROM_WALL - barWidth; } rect(barLeft,TIMEBAR_TOP,barWidth ,TIMEBAR_HEIGHT); } void drawArrows(){ fill(128); rect(ARROW_DIST_FROM_WALL-7,ARROW_TOP+20,36,30); fill(255); if( nextTurn == TURNCCW){ fill(200,0,0); } text("Z",ARROW_DIST_FROM_WALL+4,ARROW_TOP+40); fill(128); rect(SCREENSIZE - ARROW_DIST_FROM_WALL - ARROW_SIZE-4,ARROW_TOP+20,36,30); fill(255); if( nextTurn == TURNCW){ fill(200,0,0); } text("X",SCREENSIZE - ARROW_DIST_FROM_WALL - ARROW_SIZE+7,ARROW_TOP+40); /* if( nextTurn == TURNCW){ rect(SCREENSIZE - ARROW_DIST_FROM_WALL - ARROW_SIZE,ARROW_TOP,ARROW_SIZE,ARROW_SIZE); }*/ image(imgArrowCCW,ARROW_DIST_FROM_WALL,ARROW_TOP); image(imgArrowCW,SCREENSIZE - ARROW_DIST_FROM_WALL - ARROW_SIZE,ARROW_TOP); fill(0); //text("Z",20,20); }