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 & HelpSyntax Questions › Play different sketches using frameCount
Page Index Toggle Pages: 1
Play different sketches using frameCount (Read 371 times)
Play different sketches using frameCount
Jun 4th, 2008, 12:22am
 
Hello, i'm extremely newby to processing, up to now, y have only played the different sketches that come as example. What I need is to put some of this sketches together. I need to put this on a little event, as to show the program. So they must play continously, one after another, because I don't want to go back to the panel in the middle of the event. A friend told me that I can do this with frameCount or IF. But the problem is that I don't know how to program this, to jump from one sketch to another. That's it, can anyone help this newby plssssss!!!!
Re: Play different sketches using frameCount
Reply #1 - Jun 4th, 2008, 8:21pm
 
indeed, you'll need a counter. and you'll have to put everything in only one sketch.

then try something like :

Code:
int counter = 0;

void draw() {

// increse the counter
counter++;

// reset the counter if needed
if (counter == 30000) counter = 0;

// choose which code to execute depending on the counter
if (counter < 10000){
drawOne();
}
else if (counter < 20000) {
drawTwo();
}
else {
drawThree();
}
}

void drawOne() {
// sketch #1
}

void drawTwo() {
// sketch #2
}

void drawThree() {
// sketch #3
}
Page Index Toggle Pages: 1