我的代码存在的问题是。我试图按矩形的左角并消除一个代码。但是我的两个代码被淘汰了。矩形是并排的,但是没有什么东西可以将它们分开。
我试图更改逻辑运算符。但是我一直遇到同样的问题
//**Here is my code**//
color lb=#1EACE3;//Fill in light blue
color dp=#461CC6;//Fill in dark purple
color lp=#E81CCD;//Fill in light pink
color hp=#C414D8;//Fill in hot pink
color aq=#00FFFF;//Fill in aqua
color te=#008080;//Fill in teal
color db=#140FD1;//Fill in dark blue
color r=#D32815;//Fill in red
color dbb=#1556D3;//Fill in dark and light blue
color title=#8C10CB;//Fill in purple
void setup() {
background(te);
size(600, 600);
}
void draw() {
println(mouseX, mouseY);
if ((mouseX<=9)&&(mouseY<=12)) {
background(hp);
}
noStroke();//No outline color for the shapes
fill(hp);//fill in hot pink
//**This is the border**//
fill(db);
//Funtion Box**//
rect(0, 0, 50, 50);
rect(52, 1, 50, 50);
//**instructions Box**//
rect(24, 430, 500, 150);
//**This is the title**//
fill(title);//fill in light purple
textSize(30);//Text size
text("King Castle", 241, 55);//title
//**What to do**//
textSize(9.99);
text("If you want to use the draw. hold down the mouse and start drawing if you let go it will stop", 30, 450);
if (mousePressed==false) {
cursor(WAIT);
}
}
void mouseDragged() {
if ((mousePressed==true)&&(mouseY<=61)&&(mouseY<=9)) {
background(te);
}
fill(aq);//Fill in aqure
ellipse(mouseX, mouseY, 20, 30);
cursor(CROSS);
}
当我在矩形内按下时,我的两个代码都会被消除。
答案 0 :(得分:0)
//**This is my new code**//
color lb = #ADD8E6;//Fill in light blue
color pq = #AFEEEE;//Fill in paleturquoise
color te = #008080;//Fill in teal
color dt = #00CED1;//Fill in darkturquoise
color fb = #D32815;//Fill in firebrick
color y = #FFE708;//Fill in yellow
color p = #DDA0DD ;//Fill in plum
color pp=#FFDAB9;//Fill in peachpuff
color ma = #66CDAA;//Fill in mediumaquamarine
void setup() {
background(pp);
size(600, 600);
}
void draw() {
println(mouseX, mouseY);
noStroke();//No outline color for the shapes
//**This is the border**//
fill(lb);
//Funtion Box**//
rect(0, 0, 50, 50);
rect(55, 0, 50, 50);
//**instructions Box**//
rect(24, 430, 500, 150);
//**This is the title**//
fill(fb);//fill in light purple
textSize(30);//Text size
text("King Castle", 241, 55);//title
//**What to do**//
textSize(10.09);
text("If you want to draw. hold down the mouse and start drawing if you let go it will stop", 30, 450);//First Command
text("If you want to change the colour. Use the Q, W, E, R", 30, 460);//Second Command
text("You have to hold down the mouse, and select your colour. And start moving the mouse, to draw.", 30, 469);//Third Command
text("If you want the colour paleturquoise use. Key Q.", 30, 477);
text("If you want to reset the colour back to default. Use the key W.", 30, 486);
if (mousePressed==false) {
cursor(WAIT);
}
}
void mouseDragged() {
noStroke();//No outline color for the shapes
cursor(ARROW);//Curosr image to arrow
fill(pq);//peachpuff
ellipse(mouseX, mouseY, 20, 30);//cursor
if (keyCode==87) {
noStroke();//No outline color for the shapes
fill(pq);//peachpuff
ellipse(mouseX, mouseY, 20, 30);
cursor(ARROW);//Curosr image to arrow
}
if (keyCode==81) {
noStroke();//No outline color for the shapes
fill(p);//plum
ellipse(mouseX, mouseY, 20, 30);
cursor(ARROW);//Curosr image to arrow
}
//**Commands For the rect. When Pressed**//
if ((mousePressed==true)&&(mouseX<=11)&&(mouseY<=12)) {
background(dt);
}
if ((mousePressed==true)&&(mouseY<=66)&&(mouseX<=14)) {
background(ma);
}
}