My Curly brackets are not linking… I’ve tried EVERYTHING! The line 34 bracket is linked with the bracket from line 44 which is supposed to be linked to the one on the same line.
Hello @RihannaLloyd-Ev, and welcome to the forums!
Can you please provide a link to your repl (or your code) so we can help you?
/* VARIABLES */
let enterButton;
let a1Button;
let a2Button;
let b1Button;
let b2Button;
let screen = 0;
/* SETUP RUNS ONCE */
function setup() {
createCanvas(600, 400);
textAlign(CENTER);
textSize(20);
noStroke();
// Set up the home screen
background("pink");
text(
"Welcome to screen 0. This is the home screen.",
width / 2,
height / 2 - 100
);
// Create buttons for all screens
enterButton = new Sprite(width /2, height /2 +100);
a1Button = new Sprite( -200, -200);
a2Button = new Sprite(-50, -50);
}
/* DRAW LOOP REPEATS */
function draw() {
// Display enter button
enterButton.w = 100;
enterButton.h = 50;
enterButton.collider = "k";
enterButton.color = "magenta";
enterButton.text ="Enter";
// Add A1 button
a1Button.pos = x: weight/2 = 50, y: height /2 + 10;
a1Button.w = 50;
a1Button.h = 50;
a1Button.collider = "k";
a1Button.color = "magenta";
a1Button.text = "A1";
// Add A2 button
a2Button.w = 50;
a2Button.h = 50;
a2Button.collider = "k";
a2Button.color = "magenta";
a2Button.text = "A2";
}
}
// Check enter button
if(enterButton.mouse.presses()) {
print("pressed");
background("paleturquoise");
text("Welcome to screen 1. Make your choice.",
width/2,
height/2 -100);
enterButton.pos = { x: -100, y: -100 };
}
}
Sorry replit wont let me send the link!
What is the name of your repl? (I need to know so I can find the repl in your account)
Oh no I put the wrong name down so sorry!
CYOA Game Starter Code
This line had an error:
a1Button.pos = {x: weight/2 = 50, y: height /2 + 10;}
- remove the
;
after10
- between
2
and50
there is a=
which is not supposed to be there. You probably accidentally wrote it instead of one of these:+
,-
,*
,/
Here is your fixed code (on line 45):
a1Button.pos = {x: weight/2 + 50, y: height /2 + 10}
5 Likes
Thank you so much!! I appreciate you!!!
2 Likes
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.