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);
}
