I am trying to exchange all forms for images
What is the correct way to do it?
The game opens and no error appears
The image just does not appear when I press the Y key
hope someone can help me
thank you in advance
PFont font;
//PImage amarelo;
//PImage plastico;
//PImage caixa;
int number = 0;
int start = 0;
int aa =0;
PShape aaa;
int bb=0;
PShape bbb;
int cc=0;
PShape ccc;
int dd=0;
PShape ddd;
int ee =0;
PShape eee;
int ff =0;
PShape fff;
int gg =0;
PShape ggg;
int hh=0;
PShape hhh;
int ii=0;
PShape iii;
int jj =0;
PShape jjj;
int kk=0;
PShape kkk;
int ll =0;
PShape lll ;
int mm =0;
PShape mmm ;
int nn =0;
PShape nnn;
int oo =0;
PShape ooo;
int pp =0;
PShape ppp;
int qq=0;
PShape qqq;
int rr=0;
PShape rrr;
int ss =0;
PShape sss;
int tt=0;
PShape ttt;
int uu= 0;
PShape uuu;
int vv =0;
PShape vvv;
int xx =0;
PShape xxx;
int yy=0;
PImage yyy;
//PImage img;
int ww=0;
PShape www;
int zz =0;
PShape zzz;
int st=0;
PShape ste;
float[] x = new float[18];
float[] y = new float[18];
float segLength = 50;
float segHeight = 50;
float r;
float g;
float b;
float rect ;
void setup() {
size(1366,768);
strokeWeight(5);
stroke(255, 100);
//caixa = loadImage(βcaixa3.pngβ);
}
void draw() {
background(150);
//image(caixa, 0, 0);
if (start == 0){
fill(0);
rect(0,0,1366,768);
//font = createFont(βDialogInput.boldβ, 40);
// textFont(font);
textSize(70);
fill(250);
text(βPress the mouse to startβ, 300, 300);
//textAlign(CENTER, CENTER);
textSize(20);
fill(250);
text(" Drag and click the mouse and press any letter to create:", 420, 500);
fill(250);
text("Use the caps lock to take each letter individually, ", 465, 550);
fill(250);
text(βpress S to save and D to delete.β, 550, 600);
}
if (start > 0){
dragSegment(0, mouseX, mouseY);
for(int i=0; i<x.length-1; i++) {
dragSegment(i+1, x[i], y[i]);
}
if(keyPressed) {
if(key==βsβ||key== βSβ) {
println(βSavingβ¦β);
String s = βscreenβ + nf(number,4) +".jpg";
save(s);
number++;
println(βDone saving.β);
}
}
}
}
void mouseClicked() {
start =1;
}
void dragSegment(int i, float xin, float yin) {
float dx = xin - x[i];
float dy = yin - y[i];
float angle = atan2(dy, dx);
x[i] = xin - cos(angle) * segLength;
y[i] = yin - sin(angle) * segLength;
segment(x[i], y[i], angle);
x[i] = xin - cos(angle) * segHeight;
y[i] = yin - sin(angle) * segHeight;
}
void segment(float x, float y, float a) {
pushMatrix();
translate(x, y);
rotate(a);
if(keyPressed) {
if (key== βAβ||key==βdβ||key== βDβ) {
aa=0;
}
if (key==βaβ) {
aa=1;
}
}
if (aa==1) {
aaa = createShape(ARC,0, y, 80, 80, PI+QUARTER_PI, TWO_PI);
shape(aaa);
}
fill(r,g,0);
if(keyPressed) {
if (key==βYβ||key==βdβ||key== βDβ) {
yy=0;
}
if (key==βyβ) {
yy=1;
}
}
if (yy==1) {
yyy = loadImage(βcaixa3.pngβ);
//shape(yyy);
}
fill(r,0,b);
fill(0,g,b);
if(keyPressed) {
if (key==βKβ||key==βdβ||key== βDβ) {
kk=0;
}
if (key==βkβ) {
kk=1;
}
}
if (kk==1) {
kkk = createShape(ELLIPSE,0,50,10,60);
shape(kkk);
}
fill(r,g,0);
if(keyPressed) {
if (key==βKβ||key==βdβ||key== βDβ) {
kk=0;
}
if (key==βkβ) {
kk=1;
}
}
if (kk==1) {
kkk = createShape(ELLIPSE,0,10,30,5);
shape(kkk);
}
fill(r,0,b);
if(keyPressed) {
if (key==βQβ||key==βdβ||key== βDβ) {
qq=0;
}
if (key==βqβ) {
qq=1;
}
}
if (qq==1) {
qqq = createShape(RECT,0,0,30, 30);
shape(qqq);
}
fill(0,g,b);
if(keyPressed) {
if (key==βRβ||key==βdβ||key== βDβ) {
rr=0;
}
if (key==βrβ) {
rr=1;
}
}
if (rr==1) {
rrr = createShape(RECT,x,0,10, segLength);
shape(rrr);
}
fill(r,g,0);
if(keyPressed) {
if (key==βBβ||key==βdβ||key== βDβ) {
bb=0;
}
if (key==βbβ) {
bb=1;
}
}
if (bb==1) {
bbb = createShape(ELLIPSE,0,y,20,60);
shape(bbb);
}
fill(0,g,b);
if(keyPressed) {
if (key==βCβ||key==βdβ||key== βDβ) {
cc=0;
}
if (key==βcβ) {
cc=1;
}
}
if (cc==1) {
ccc = createShape(ELLIPSE,0,0,50,50);
shape(ccc);
}
fill(r,0,b);
if(keyPressed) {
if (key==βEβ||key==βdβ||key== βDβ) {
ee=0;
}
if (key==βeβ) {
ee=1;
}
}
if (ee==1) {
eee = createShape( TRIANGLE,300, 75, 8, 20, 6, 7);
shape(eee);
}
fill(0,g,b);
if(keyPressed) {
if (key==βFβ||key==βdβ||key== βDβ) {
ff=0;
}
if (key==βfβ) {
ff=1;
}
}
if (ff==1) {
fff = createShape( LINE,0, 30, 75, 85);
shape(fff);
}
fill(r,g,0);
if(keyPressed) {
if (key==βGβ||key==βdβ||key== βDβ) {
gg=0;
}
if (key==βgβ) {
gg=1;
}
}
if (gg==1) {
ggg = createShape( ELLIPSE,40,40,10,10);
shape(ggg);
}
fill(0,g,b);
if(keyPressed) {
if (key==βHβ ||key==βdβ||key== βDβ ){
hh=0;
}
if (key==βhβ) {
hh=1;
}
}
if (hh==1) {
hhh = createShape( RECT,X,Y,10,300);
shape(hhh);
}
fill(r,0,b);
if(keyPressed) {
if (key==βIβ||key==βdβ||key== βDβ) {
ii=0;
}
if (key==βiβ) {
ii=1;
}
}
if (ii==1) {
iii = createShape( ELLIPSE,0,y,80,40 );
shape(iii);
}
fill(r,g,0);
if(keyPressed) {
if (key==βJβ||key==βdβ||key== βDβ) {
jj=0;
}
if (key==βjβ) {
jj=1;
}
}
if (jj==1) {
jjj = createShape(ARC, X, 100, 95, 50, 0, HALF_PI );
shape(jjj);
}
fill(r,0,b);
if(keyPressed) {
if (key==βJβ||key==βdβ||key== βDβ) {
jj=0;
}
if (key==βjβ) {
jj=1;
}
}
if (jj==1) {
jjj = createShape(TRIANGLE,30, 70, 80, 12, 16, 13);
shape(jjj);
}
fill(0,g,b);
if(keyPressed) {
if (key==βKβ||key==βdβ||key== βDβ) {
kk=0;
}
if (key==βkβ) {
kk=1;
}
}
if (kk==1) {
kkk = createShape(ARC, 50, 55, 50, 50, 0, HALF_PI );
shape(kkk);
}
fill(r,g,0);
if(keyPressed) {
if (key==βLβ||key==βdβ||key== βDβ) {
ll=0;
}
if (key==βlβ) {
ll=1;
}
}
if (ll==1) {
lll = createShape(LINE,x,40, 85, 75 );
shape(lll);
}
fill(r,0,b);
if(keyPressed) {
if (key==βMβ||key==βdβ||key== βDβ) {
mm=0;
}
if (key==βmβ) {
mm=1;
}
}
if (mm==1) {
mmm = createShape(RECT,69,0,20,40);
shape(mmm);
}
if(keyPressed) {
if (key==βMβ||key==βdβ||key== βDβ) {
mm=0;
}
if (key==βmβ) {
mm=1;
}
}
if (mm==1) {
mmm = createShape(RECT,x,10,60,10);
shape(mmm);
}
fill(r,0,b);
if(keyPressed) {
if (key==βNβ||key==βdβ||key== βDβ) {
nn=0;
}
if (key==βnβ) {
nn=1;
}
}
if (nn==1) {
nnn= createShape(TRIANGLE,x, 0, 8, 50, 6, 15);
shape(nnn);
}
fill(0,g,b);
if(keyPressed) {
if (key == βOβ ||key==βdβ||key== βDβ) {
oo=0;
}
if (key==βoβ) {
oo=1;
}
}
if (oo==1) {
ooo= createShape(ELLIPSE,0,y,50,10);
shape(ooo);
}
fill(r,g,0);
if(keyPressed) {
if (key==βOβ||key==βdβ||key== βDβ) {
oo=0;
}
if (key==βoβ) {
oo=1;
}
}
if (oo==1) {
ooo= createShape(ELLIPSE,0,y,20,20);
shape(ooo);
}
fill(r,0,b);
if(keyPressed) {
if (key==βPβ||key==βdβ||key== βDβ) {
pp=0;
}
if (key==βpβ) {
pp=1;
}
}
if (pp==1) {
ppp= createShape(TRIANGLE,0, 500, 4, 0, 6, 30);
shape(ppp);
}
fill(0,g,b);
if(keyPressed) {
if (key==βTβ||key==βdβ||key== βDβ) {
tt=0;
}
if (key==βtβ) {
tt=1;
}
}
if (tt==1) {
ttt= createShape (TRIANGLE,30, 75, 58, 20, 86, 75);
shape(ttt);
}
fill(r,0,b);
if(keyPressed) {
if (key==βTβ||key==βdβ||key== βDβ) {
tt=0;
}
if (key==βtβ) {
tt=1;
}
}
if (tt==1) {
ttt= createShape (TRIANGLE,75, 16,30, 75, 58, 20 );
shape(ttt);
}
fill(r,g,0);
if(keyPressed) {
if (key==βUβ||key==βdβ||key== βDβ) {
uu=0;
}
if (key==βuβ) {
uu=1;
}
}
if (uu==1) {
uuu= createShape ( ARC, 50, 55, 600, 60, HALF_PI, PI);
shape(uuu);
}
fill(0,g,b);
if(keyPressed) {
if (key==βVβ||key==βdβ||key== βDβ) {
vv=0;
}
if (key==βvβ) {
vv=1;
}
}
if (vv==1) {
vvv= createShape (RECT,0,0,90,7);
shape(vvv);
}
fill(0,g,b);
if(keyPressed) {
if (key==βXβ||key==βdβ||key== βDβ) {
xx=0;
}
if (key==βxβ) {
xx=1;
}
}
if (xx==1) {
xxx= createShape (ELLIPSE,6, 100,100,100);
shape(xxx);
}
fill(r,0,b);
if(keyPressed) {
if (key==βZβ||key==βdβ||key== βDβ) {
zz=0;
}
if (key==βzβ) {
zz=1;
}
}
if (zz==1) {
zzz= createShape (TRIANGLE,0, 10 ,300, 50, 600, 5);
shape(zzz);
}
fill(r,g,0);
if(keyPressed) {
if (key==βWβ||key==βdβ||key== βDβ) {
ww=0;
}
if (key==βwβ) {
ww=1;
}
}
if (ww==1) {
www= createShape (RECT,90,50,40,10);
shape(www);
}
fill(r,0,b);
if(keyPressed) {
if (key==βWβ||key==βdβ||key== βDβ) {
ww=0;
}
if (key==βwβ) {
ww=1;
}
}
if (ww==1) {
www= createShape (RECT,10,60,10,40);
shape(www);
}
ellipse(0,80, 30,30);
fill(250);
ellipse(80,0,15,15);
line(0, 0, segLength, 0);
line(0, y, segLength, 0);
ellipse(0,80, 10,10);
line(0,0, segHeight, segLength);
popMatrix();
}
void mousePressed(){
r = random(0,255);
g = random (0,255);
b = random(0,255);
}