can i send someone my code and they can explain why i have an error and how to fix it
Yeah just post it and we have a look
int xKite = mouseX;
int yKite = mouseY;
int xSpeed = 5;
int ySpeed = 5;
int count;
int displayText;
boolean sky,
draggable = false;
int level=1;
int level=2;
void setup() {
size(1000, 600);
}
void draw() {
if (level==1) {
count = 1;
displayText(count);
textSize(14);
fill(255);
text (“Press, then drag, the mouse in the brown area (rooftop) to begin”);
background(121, 218, 252);
fill(84, 41, 41);
rect(0, (4 * height)/4, width * 2, height/2);
rectMode(CENTER);
strokeWeight(13);
stroke(137, 122, 91);
line(333, 600, 333, 0);
stroke(0);
strokeWeight(3);
line(0, 25, 325, 25);
line(0, 50, 325, 50);
line(0, 75, 325, 75);
strokeWeight(1);
line(0, 37.5, 326, 37.5);
line(0, 62.5, 326, 62.5);
if (sky) {
yKite -= ySpeed;
}
if (xKite<390 && xKite>0 && yKite<75 && yKite>0) {
xSpeed=0;
ySpeed=0;
}
noStroke();
fill(252, 65, 188);
triangle(xKite, yKite, xKite - 50, yKite, xKite - 50, yKite + 50);
triangle(xKite - 50, yKite, xKite - 100, yKite, xKite - 50, yKite - 50);
ellipseMode(CENTER);
rectMode(CENTER);
fill(0, 0, 255);
ellipse(xKite - 50, yKite, 50, 50);
fill(255, 105, 180);
ellipse(xKite - 50, yKite, 40, 40);
fill(255, 255, 55);
triangle(xKite, yKite, xKite - 50, yKite, xKite - 50, yKite - 50);
triangle(xKite - 50, yKite, xKite - 100, yKite, xKite - 50, yKite + 50);
fill(0, 0, 255);
rect(xKite - 50, yKite, 20, 20);
fill(0, 255, 0);
rect(xKite - 50, yKite, 17.5, 17.5);
stroke(125);
line(xKite - 50, yKite + 50, xKite - 42.5, yKite + 125);
stroke(125);
fill(0, 255, 0);
triangle(xKite - 50, yKite + 50, xKite - 70, yKite + 70, xKite - 30, yKite + 70);
stroke(125);
noFill();
ellipse(xKite - 57.5, yKite + 50, 17.5, 7.5);
ellipse(xKite - 42.5, yKite + 50, 17.5, 7.5);
strokeWeight(3);
line(xKite - 50, yKite + 50, xKite - 57.5, yKite + 95);
}
}
}
void mousePressed() {
if (!sky) {
if (mouseY > 450) {
draggable = true;
xKite = mouseX;
yKite = mouseY;
} else if (mouseY < 450) {
draggable = false;
}
}
}
void mouseDragged() {
if (draggable) {
yKite = mouseY;
xKite = mouseX;
}
}
void mouseReleased() {
if (draggable && mouseY <= 450) {
draggable = false;
sky = true;
}
}
WHAT is the error and which functions do we have to look at…?
(or from your other thread…?)
I receive multiple errors, one is that the function displayText() is unknown - do you have this function, maybe in another tab?
What is “level
” supposed to do? This won’t work:
// ???
int level=1;
int level=2;
Remarks
-
The brown rectangle is the roof? Why is it below? Sorry, I am not sure I understand.
-
Remark:
rectMode(CENTER);
must be beforerect()
to have effect.