Problem with Javascript project - Project Fishtank
I am working on Project Fishtank in "Intro to JS: Drawing & Animations". I am having problems getting past steps 2 and 3 (calling functions). I am not able to move the fish around because all my fish end up on top of each other in the same location instead of being spread out in different locations. Here is what I have so far:
background(89, 216, 255);
var centerX = 200;
var centerY = 100;
var bodyLength = 118;
var bodyHeight = 74;
var bodyColor = color(162, 0, 255);
noStroke();
fill(bodyColor);
// body
ellipse(centerX, centerY, bodyLength, bodyHeight);
// tail
var tailWidth = bodyLength/4;
var tailHeight = bodyHeight/2;
triangle(centerX-bodyLength/2, centerY,
centerX-bodyLength/2-tailWidth, centerY-tailHeight,
centerX-bodyLength/2-tailWidth, centerY+tailHeight);
// eye
fill(33, 33, 33);
ellipse(centerX+bodyLength/4, centerY, bodyHeight/5, bodyHeight/5);
Please sign in to leave a comment.