Hi, I'm
a beginner in processing. I need to create a word puzzle game that when you piece the letterstogether in the correct position it gives you a feedback(positive).
At the moment, in my case this feedback is drawing a rect, but I have a problem with it.
I modified a puzzle code, that I found on openprocessing,and this is the code:
PImage images [];
rettangolo pezzi[];
int pos_x, pos_y, dragged_box, grid_x,grid_y;
boolean config_iniziale;
int state1;
int state2;
int state3;
void setup(){
images = new PImage [3];
pezzi = new rettangolo[3];
for(int i=0; i<3; i++){
images[i]= loadImage(i+".png");}
size(1000, 700);
pos_x =300;
pos_y = 500;
config_iniziale = true;
dragged_box =-1;
grid_x = 255; grid_y =200;
}
class rettangolo {
int x1,x2,y1,y2;
int ini_x1,ini_x2,ini_y1,ini_y2;
rettangolo(int x1,int y1,int x2,int y2){
this.x1 = ini_x1=x1;
this.y1 = ini_y1=y1;
this.x2 = ini_x2=x2;
this.y2 = ini_y2=y2;
}
boolean over(int x,int y){
return (x>=x1 && x<=x2 && y>=y1 && y<=y2);
}
}
void draw(){
background(255);
fill(230);
noStroke();
rect(grid_x, grid_y, 500 ,200);
int x=pos_x,y=pos_y;
if(config_iniziale){
config_iniziale = false;
for(int i=0;i<3;i++){
pezzi[i] = new rettangolo(int (random(x)), int (random(y)),x+500,y+500);