Ask your own question, for FREE!
MIT 6.189 A Gentle Introduction to Programming Using Python (OCW) 15 Online
OpenStudy (anonymous):

Need help on this code, but I got this so much far; float bX = 50; float bY = 60; float bWidth = 55; float bHeight = 70; color balloonColor = color(255, 0, 0); float bHSpeed = 2; float bVSpeed = 1; void setup() { size(300, 300); bWidth = random(10, 55); bHeight = random(10, 70); balloonColor = color(random(0, 255), random(0, 255), random(0, 255)); // randomly set the balloon color ellipse(bX + 50, bY + 60, bWidth + 55, bHeight + 70); // set bX and bY; make sure that the balloon //will be entirely on screen when it starts bX = random(bWidth / 2.0, width - bWidth / 2.0); bHSpeed = 2; bVSpeed = 2; smooth(); } void draw( ) { background(255); drawHouse(150, 200, 80, 80); drawHouse(20, 100, 120, 150); drawBalloon(bX, bY, bWidth, bHeight, balloonColor);// draw the balloon by calling drawBalloon() // if there is a horizontal bounce, reverse horizontal speed // if there is a vertical bounce, reverse vertical speed } /* Your code for drawBalloon( ) goes here */ void drawBalloon(float x, float y, float w, float h, color c) { fill(c); ellipse(x, y, w, h); } /* Your code for drawHouse( ) goes here */ void drawHouse(float x, float y, float w, float h) { float topY = y + h / 3.0; fill(255); stroke(0); triangle(x + w / 2.0, y, x, topY, x + w, topY); rect(x, topY, w, 2.0 * h / 3.0); rect(x + w / 8.0, y + h / 3.0 + (0.125) * 2 * h / 3.0, w / 8.0, h / 8.0); rect(x + 5.0 / 8.0 * w, y + 3.0 / 4.0 * h, 3.0 / 16.0 * w, h / 4.0); }

OpenStudy (pdpinch):

This doesn't look like Python. You might have better luck posting this in the 6.00 group.

OpenStudy (rsmith6559):

When in doubt, decompose it ( break it down ) more. Both of the draw functions need the coordinates to start at, and size and color information to draw a static image. Any movement would be done by other function[s].

OpenStudy (anonymous):

which programing language you are using

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!