We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Question about Catcher and Drops
Page Index Toggle Pages: 1
Question about Catcher and Drops (Read 501 times)
Question about Catcher and Drops
Apr 25th, 2010, 5:13pm
 
Hi everyone,

I'm new to programming and have just began using processing.

I'm trying to create something similar to the Rain Drop Catching Game found here:

10-10/

but I also want it to keep score(eventually).

I've tried to integrate the code with the code I'm writing but I haven't had any luck.

If someone could point me in the right direction I'd really appreciate it because I have a project due in 2 days and have been really struggling with this.

The code that i've written is pretty bare bones, and I deleted all of the code I had for the drops and catcher because it doesn't work.

Here's the code:


int startingTime;
final String prefix = "";

void setup(){
size(1000,650);
background(0);
PFont font = loadFont ("AppleGothic-48.vlw");
textFont(font);

startingTime = millis();

}


void draw(){

background (0);
stroke (200);

//The following lines of code are for the back wall.
fill(139,119,120);
rect(0,0,1000,570);

//The following line of code are for the Television.
//Antenna:
fill(220,220,220);
line(400,100,500,250);
line(600,100,500,250);
ellipse(500,250,70,70);
//End Antenna.

//Television Box
fill(160,82,45);
rect(350,250,300,200);
//Television Screen
fill(135,206,250);
rect(375,275,250,150);
//Television done.

//The following lines of code are for the television stand.
fill(139,69,19);
rect(350,450,300,120);

fill(184,134,11);
rect(375,475,120,75);
rect(505,475,120,75);

stroke(320);
fill(0);
ellipse(480,515,20,20);
ellipse(520,515,20,20);




int seconds = (millis() - startingTime)/1000;
int minutes = seconds/60;
seconds -= minutes*60;


String message = prefix +
     GetPlural(minutes, "minute") + " " +
     GetPlural(seconds, "second");


println(message);




fill(0,150,0);
text(message, 520, 630);
}

String GetPlural(int value, String word){
 if (value ==1)
 return value +""+ word;
 return value +""+ word + "s";
}

{startingTime = millis();
}

//Created by Aaron Allstott

Any input would be greatly appreciated, thanks.
Re: Question about Catcher and Drops
Reply #1 - Apr 25th, 2010, 5:13pm
 
Here's the url for the rain catching game:

http://www.learningprocessing.com/examples/chapter-10/example-
Page Index Toggle Pages: 1