We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello ! I'm trying to make interaction with my mouse , we have to hit the buttons and create numbers ,if the code "123" appears it makes a sound then if the code is "121" appears it writes "a brown fox...." The numbers restart for the code 123 but when I make 121 ,i can 't click anymore 1 ... I'm obliged to click on others numbers... but I would like to make again 123 :o if someone can help me ,I'll be gratefull!
class MaConsole {
float x, y;
String message;
color couleur;
PFont font;
MaConsole(float _x, float _y) {
x=_x;
y=_y;
message=""; //on initialise le msg
couleur = color(0, 102, 153);
font=loadFont("Garamond-48.vlw");
textFont(font, 32);
}
void restart(){
if(message.length()>3){
message="";
}
}
void updateMessage(String _str) {
String lastCharacter ="";
String last1 ="";
String last2 = "";
if (message.length() > 0) {
lastCharacter = message.substring(message.length()-1);
}
if (message.length() >=3 ) {
last1 = message.substring(message.length()-3);
if(last1.equals("123")){
player.play();
if (!player.isPlaying()){
player.rewind();
player.pause();
}
}
}
if(message.length()>=3){
if (last1.equals("121")){
last1 = message.substring(message.length()-3);
text("A quick brown fox jumps over the lazy dog",150,150 );
}
}
if (lastCharacter.equals(_str)) {
println("dernière zone active");
}
else {
message = message + _str;
}
}
void display() {
fill(couleur);
text(message, x, y);
}
}
Thank you !!
Answers
Hi! It appears that you are only showing part of your program. There's no setup(), no draw(), no mouseMoved(), no keyPressed()... It's hard to know how to fix it without running it :)