Created
February 21, 2023 00:53
-
-
Save EllaY44/82ea05aeb18cc78d142b35419d218942 to your computer and use it in GitHub Desktop.
homework week 4 question
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global circleX, direction | |
circleX = 500 | |
direction = 8 | |
global circletwoX, directiontwo | |
circletwoX = 450 | |
directiontwo = 3 | |
global circlethreeX, directionthree | |
circlethreeX = 550 | |
directionthree = 6 | |
def setup(): | |
size (600, 600) | |
noStroke | |
def draw(): | |
global circleX, direction | |
background(255, 255, 255) | |
img = loadImage("cat-raster-image.png") | |
image(img, 0, 0, 600, 600) | |
fill(165, 131, 98) | |
ellipse(circleX, 500, 50, 50) | |
circleX = circleX + direction | |
if circleX > 500: | |
direction = -15 | |
if circleX < 120: | |
direction = 15 | |
global circletwoX, directiontwo | |
fill(252, 222, 240) | |
ellipse(circletwoX, 450, 60, 60) | |
circletwoX = circletwoX + directiontwo | |
if circletwoX > 520: | |
directiontwo = -10 | |
if circletwoX < 150: | |
directiontwo = 10 | |
fill(236, 214, 255) | |
circle(335, 350, 35) | |
if mousePressed: | |
global circlethreeX, directionthree | |
fill(176, 211, 252) | |
ellipse(circlethreeX, 550, 40, 40) | |
circlethreeX = circlethreeX + directionthree | |
if circlethreeX > 600: | |
directionthree = -10 | |
if circlethreeX < 0: | |
directionthree = 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
All those corrections worked; thank you! @rors