Created
October 24, 2021 18:08
-
-
Save sgodycki/a83cea5b1896833e0e9ba6a3281382de to your computer and use it in GitHub Desktop.
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 img | |
circleY = 300 | |
circleDirection = 1 | |
position = 0 | |
startTime = 0 | |
rectY = 200 | |
rectDirection =1 | |
def drawLevel1(): | |
global circleY, circleDirection, startTime, position | |
# image(img,0,0) | |
fill(150,50,200) | |
rect(position,200, 50,50) | |
# move for a little while, then stop | |
if millis() > startTime and millis() < startTime + 2000: | |
position = position + 1 | |
# wait a little while, then reset the startTime variable, | |
# so the above timing starts over: | |
if millis() > startTime + 4000: | |
startTime = millis() | |
global rectY | |
fill(200,50,150) | |
rect(200,rectY,50,50) | |
global rectDirection | |
rectY= rectY + rectDirection | |
if rectY > width: | |
rectDirection = -1 | |
fill(102,51,0) | |
ellipse(300,circleY, 50,50) | |
circleY = circleY + circleDirection | |
if circleY > width: | |
circleDirection = -1 | |
if circleY < 0: | |
circleDirection = 1 | |
if keyPressed: | |
if key == 'j': | |
circleDirection = -1 | |
if key == 'l': | |
circleDirection =1 | |
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
def drawLevel2(): | |
global img, circleY, circleDirection, startTime, position | |
image(img,0,0) | |
fill(50,150,200) | |
rect(position,200, 50,50) | |
# move for a little while, then stop | |
if millis() > startTime and millis() < startTime + 1000: | |
position = position + 1 | |
# wait a little while, then reset the startTime variable, | |
# so the above timing starts over: | |
if millis() > startTime + 3000: | |
startTime = millis() | |
global rectY | |
fill(200,50,100) | |
rect(200,rectY,50,50) | |
global rectDirection | |
rectY= rectY + rectDirection | |
if rectY > width: | |
rectDirection = -1 | |
fill(102,51,0) | |
ellipse(300,circleY, 50,50) | |
circleY = circleY + circleDirection | |
if circleY > width: | |
circleDirection = -1 | |
if circleY < 0: | |
circleDirection = 1 | |
if keyPressed: | |
if key == 'j': | |
circleDirection = -1 | |
if key == 'l': | |
circleDirection =1 | |
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
""" | |
Sasha Godycki | |
CD Toolkit Python Fall 2021 | |
Midterm 10.26.21 | |
""" | |
from Level_1 import* | |
from Level_2 import* | |
level = 1 | |
circleY = 300 | |
circleX = 300 | |
circleDirection = 1 | |
position = 0 | |
startTime = 0 | |
rectY = 200 | |
rectDirection =1 | |
def setup(): | |
global img | |
size(576,720) | |
img = loadImage("grass background.png") | |
stroke(50,50,150) | |
def draw(): | |
if level == 1: | |
drawLevel1() | |
elif level ==2: | |
drawLevel2() | |
image(img,0,0) | |
global circleY, circleDirection, startTime, position | |
global circleX | |
fill(50,150,200) | |
rect(position,200, 50,50) | |
# move for a little while, then stop | |
if millis() > startTime and millis() < startTime + 2000: | |
position = position + 1 | |
# wait a little while, then reset the startTime variable, | |
# so the above timing starts over: | |
if millis() > startTime + 4000: | |
startTime = millis() | |
global rectY | |
fill(200,50,150) | |
rect(200,rectY,50,50) | |
global rectDirection | |
rectY= rectY + rectDirection | |
if rectY > width: | |
rectDirection = -1 | |
fill(102,51,0) | |
ellipse(circleX,circleY, 50,50) | |
circleY = circleY + circleDirection | |
circleX = circleX + circleDirection | |
if circleX > width: | |
circleDirection = 1 | |
if keyPressed: | |
if key == 'j': | |
circleDirection = -1 | |
if key == 'l': | |
circleDirection =1 | |
if circleY > width: | |
circleDirection = -1 | |
if keyPressed: | |
if key == 'a': | |
circleDirection = 1 | |
if key == 'b': | |
circleDirection = -1 | |
if keyPressed: | |
if key == 'j': | |
circleDirection = -1 | |
if key == 'l': | |
circleDirection =1 |
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
mode=Python | |
mode.id=jycessing.mode.PythonMode |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes it did fix the previous bug