I have a problem, I would like to stop the timer when I press a key.
I know I need to use the function "keyPressed" but I can't do it... Can you please help me?
Thanks!
//timer int l;
//time int seconde = 0;
//display score and attempts's number void score() { fill(255); //results display text(score, -0.25*width_size, 0.565*height_size); text(essais, 0.12*width_size, 0.565*height_size); }
//controls if a fiduciary is on the right planet or not and flash in green or in red void flashing() { //-1 for the loop "for" int myObjSize=myObj.size(); int planetsPropsSize=planetsProps.size(); //time in milliseconds int timer = millis(); int a=timer/1000; //time is seconds float k=timer/1000; //yellow rectangle to follow a fiducial fill(255, 255, 0, 100); //rect(objectPositionX, (objectPositionY-50), 80, 80); rect(objectPositionX-30, objectPositionY-30, 60, 60); //initializing score score=0;
//for each PLANET for (int j = 0; j < planetsPropsSize; j++) {
//table with planets properties tobj0 = (ArrayList)planetsProps.get(j); // An ArrayList doesn't know what it is storing so we have // to cast the object coming out //center of the planet X and Y Float planetX = (Float) tobj0.get(0); Float planetY = (Float)tobj0.get(1); //width of the planet Float planetW=(Float)tobj0.get(2); //height of the planet Float planetH=(Float)tobj0.get(3); //status of the fiducial moving on the table String statusP = (String)tobj0.get(5); String statusNew = "none";
//go through each object and check if there is any on the planet //for ( int i=0; i < myObjSize; i++) { for ( int i=0; i < myObj.size(); i++) { //chosen object
//check if the object is on the planet //if (sqrt(((objectPositionX+40)-planetX)*((objectPositionX+40)-planetX) + ((objectPositionY-40)-planetY)*((objectPositionY-40)-planetY)) <= planetW/2 ) { if (sqrt(((objectPositionX)-planetX)*((objectPositionX)-planetX) + ((objectPositionY)-planetY)*((objectPositionY)-planetY)) <= planetW/2 ) { //don't fill the ellipse j noFill(); //check fiducial's number and it's the good one if (currentObjectOnTable.getSymbolID()==j) { statusNew = "correct"; //modify the status to "correct" if (!statusP.equals("correct")) { tobj0.set(5, "correct"); //println("planet " + j + " is " + (String)tobj0.get(5)); } //increment score score+=1; //display a green circle stroke(174, 221, 60); //outine green ellipse(planetX, planetY, planetW, planetH); break; } //check fiducial's number and it's not the good one else { statusNew = "false"; //display a red circle stroke(254, 0, 0); //outine red ellipse(planetX, planetY, planetW, planetH); //changes the status of discovery of planet to "false" if (!statusP.equals("false")) { //println("last frame was " + statusP); essais+=1; tobj0.set(5, "false"); //println("planet " + j + " is " + (String)tobj0.get(5)); break; } break; } } } //endfor each object
//check if no object was found on the planet if (statusNew.equals("none")) { tobj0.set(4, "0"); tobj0.set(5, "none"); //println("planet " + j + " is " + (String)tobj0.get(5)); } } //endfor each planet
I have a problem with my program, I just want to display an image when I wait during 5 seconds. The fact is that the image comes and leave immedialetly! 1 second maybe...
I let you my code if you want to help me. Thanks!
// we need to import the TUIO library
import TUIO.*;
//and the libraries for the sound
import ddf.minim.*;
import ddf.minim.signals.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
// we also need to declare a TuioProcessing client variable and a TuioObject variable
TuioProcessing tuioClient;
//timer
int l;
void setup()
{
size(1000, 1000);
//lisser l'image
smooth();
//outline of a shape
noStroke();
//fill in black
fill(0);
}
// within the draw method we retrieve a Vector (List) of TuioObject and TuioCursor (polling)
// from the TuioProcessing client and then loop over both lists to draw the graphical feedback.
does anybody knows how to manageSimulatorwithProcessing?I have a problemwith thefieldand Iwould like tomakechangesbutI can not findthe variables thatitmanagesonprocessing. thanks
I have a problem and I can't find the solution.
Actually, I don't find how I can select a fiducials and check its position (with TUIO simulator).
I wantto matchafiducialsto a planetof the solar system, and I have 9 planets. So, I need to identify each fiducial and each planet (with its coordinates) to check if the player has matchedthe rightfiducialswith the rightcoordinates. If you have an idea let me know about it please ;)