Open ascha19 opened 5 years ago
@aschave19 When making new functions you need to make them a little different then you did.
you had semicolons after the name of the function.
function bone();{
//code and stuff
}
it should look like
function bone(){
//code and stuff
}
One other thing was for some reason the function circle didn't seem to be working so I changed it to an ellipse.
From the code you posted this runs so far
//I felt like making a dumb joke and wanted to see if I could make images for it. If anyone gets it, bless.
//Array and functions time
let dumbArray = ["Bone", "Apple", "Teeth"];
let bgColor = 200;
let idx = 0;
//Basic setup stuff; canvas, framerate, background color, etc
function setup() {
createCanvas(800, 400);
frameRate(5);
}
//Basic setup stuff; background, text size, etc
function draw() {
background(bgColor);
textSize(20);
//Writing the text
text("When the meal's real good:" + dumbArray[idx], 200, 200);
//Making sure array boundaries are followed
idx = (idx+1) % 3;
//Allowing new functions to be called
bone();
apple();
teeth();
}
//Drawing the bone
function bone(){
stroke(255);
fill(254, 255, 213);
rect(0, 0, 20, 10);
ellipse(0, 0, 2.5);
ellipse(0, 10, 2.5);
ellipse(20, 0, 2.5);
ellipse(20, 10, 2.5);
}
//Drawing the apple
function apple(){
//Body
// noStroke();
fill(175, 0, 5);
ellipse(100,100, 10);
// //Stem
fill(0);
line(0, 0, 20, 20);
}
//Drawing the teeth
function teeth(){
//Mouth
stroke('black');
arc(0, 0, 20, 10, 0, PI + QUARTER_PI, CHORD);
//Teeth line/Gap tooth
strokeWeight(5);
line(0, 0, 0, 20);
}
@tjschweitzer Altering the code, for whatever reason, didn't work, but once I moved the new code to a new sketch it worked fine. Not sure what was wrong with the first sketch, but everything seems to be working now, except I'm not sure how to make my images appear and disappear with their corresponding word. I'm attempting to use if condition but now only the bone is visible (at all times) and the apple and smiley aren't visible at all.
Regardless, thanks for the help again!
maybe try working on you spacing
If you keep having problems on this please come in for office hours after we get back from break!
On Mar 19, 2019, at 9:56 PM, Avery notifications@github.com wrote:
@tjschweitzer https://github.com/tjschweitzer Altering the code, for whatever reason, didn't work, but once I moved the new code to a new sketch it worked fine. Not sure what was wrong with the first sketch, but everything seems to be working now, except I'm not sure how to make my images appear and disappear with their corresponding word. I'm attempting to use if condition but now only the bone is visible (at all times) and the apple and smiley aren't visible at all.
Regardless, thanks for the help again!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Montana-Media-Arts/120_CreativeCoding/issues/221#issuecomment-474675099, or mute the thread https://github.com/notifications/unsubscribe-auth/AeD_pp7JeIT2S1PfJz05JS6ezXceF7BJks5vYbFzgaJpZM4b7QRT.
So, I got the first half of the assignment figured out and out of the way. Now I'm working on the second assignment, the new sketch, and nothing's showing up still. I'm continuing to work on it because I'm still trying to figure out how I want the objects to move, but I've tried to find and fix the problem and once again haven't come up with a solution. Here's the code so far.