Skip to content

Instantly share code, notes, and snippets.

@extrajordanary
Last active November 5, 2018 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save extrajordanary/9e2a899a02f8dd73aa705b7cd061d779 to your computer and use it in GitHub Desktop.
Save extrajordanary/9e2a899a02f8dd73aa705b7cd061d779 to your computer and use it in GitHub Desktop.
fixing braces
var skyColor;
var cloud;
var rightCreature;
var leftCreature;
function setup() {
createCanvas(400, 400);
// I removed the } and not sure exactly what happened
// when you mention } are you also reffering to the way the } should be placed?
skyColor = color(100, 200, 255)
} // NOTE: this brace is closing the setup function too soon, delete it
cloud = // NOTE: cloud is an object and needs braces around it, put the { here after the =
color: color(255, 255, 255, 250),
height: 100,
yOffset: 50,
// NOTE: put the closing brace for cloud here }
// #2a Create rightCreature object with properties
rightCreature = {
color1: color1(100, 200, 10, 0),
color2: color2(20, 200, 0, 0),
height: 50,
width: 20,
xOffset: 40,
};
// #2b Create leftCreature object with properties
leftCreature = {
color1: color1(10, 25, 100, 0),
color2: color2(200, 0, 25, 0),
height: 60,
width: 30,
xOffset: -40,
// Bonus 1
}; // NOTE: this brace closes the leftCreature object, leave it here
} // NOTE: this brace is the correct end of the setup function, leave it here
function draw() {
background(skyColor);
helperDrawCloud();
// #3a Draw rightCreature on the right side of the cloud
// #3b Draw leftCreature on the left side of the cloud
}
// #4a Add mousePressed()
// #4b Use random() and setRed() to change skyColor
// Bonus 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment