Skip to content

Commit

Permalink
Comments to PEP8
Browse files Browse the repository at this point in the history
  • Loading branch information
pjbRPF committed Jul 13, 2023
1 parent 508614f commit 525e29f
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 42 deletions.
18 changes: 9 additions & 9 deletions en/step_2.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ line_number_start: 7
line_highlights: 8
---

#Setup global variables
# Setup global variables
screen_size = 400

--- /code ---
Expand All @@ -55,7 +55,7 @@ line_highlights: 20
---

def setup():
#Setup your animation here
# Setup your animation here
size(screen_size, screen_size)


Expand Down Expand Up @@ -93,11 +93,11 @@ line_highlights: 21-23
---

def setup():
#Setup your animation here
# Setup your animation here
size(screen_size, screen_size)
image_mode(CENTER) # Positions the image in the center
image_mode(CENTER) # Positions the image in the center
global planet
planet = load_image('planet.png') # Your chosen planet
planet = load_image('planet.png') # Your chosen planet


--- /code ---
Expand Down Expand Up @@ -125,10 +125,10 @@ line_number_start: 14
line_highlights: 15-17
---

#The draw_background function goes here
# The draw_background function goes here
def draw_background():
background(0) #Short for background(0, 0, 0) — black
image(planet, width/2, height, 300, 300) #Draw the image
background(0) # Short for background(0, 0, 0) — black
image(planet, width/2, height, 300, 300) # Draw the image


--- /code ---
Expand All @@ -151,7 +151,7 @@ line_highlights: 30
---

def draw():
#Things to do in every frame
# Things to do in every frame
draw_background()

--- /code ---
Expand Down
14 changes: 7 additions & 7 deletions en/step_3.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ line_highlights: 24, 26
---

def setup():
#Setup your animation here
# Setup your animation here
size(screen_size, screen_size)
image_mode(CENTER)
global planet, rocket
Expand Down Expand Up @@ -61,9 +61,9 @@ line_number_start: 7
line_highlights: 9
---

#Setup global variables
# Setup global variables
screen_size = 400
rocket_y = screen_size #Start at the bottom
rocket_y = screen_size # Start at the bottom

--- /code ---

Expand All @@ -84,10 +84,10 @@ line_number_start: 11
line_highlights: 12-16
---

#The draw_rocket function goes here
# The draw_rocket function goes here
def draw_rocket():
global rocket_y #Use the global rocket_y variable
rocket_y -= 1 #Move the rocket
global rocket_y # Use the global rocket_y variable
rocket_y -= 1 # Move the rocket
image(rocket, width/2, rocket_y, 64, 64)


Expand All @@ -109,7 +109,7 @@ line_highlights: 36
---

def draw():
#Things to do in every frame
# Things to do in every frame
draw_background()
draw_rocket()

Expand Down
12 changes: 6 additions & 6 deletions en/step_4.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def draw_rocket():

no_stroke() #Turn off the stroke

for i in range(25): #Draw 25 burning exhaust ellipses
fill(255, 255, 0) #Yellow
ellipse(width/2, rocket_y + i, 8, 3) #i increases each time the loop repeats
for i in range(25): # Draw 25 burning exhaust ellipses
fill(255, 255, 0) # Yellow
ellipse(width/2, rocket_y + i, 8, 3) # i increases each time the loop repeats

image(rocket, width/2, rocket_y, 64, 64)

Expand Down Expand Up @@ -84,7 +84,7 @@ line_highlights: 19
---

for i in range(25):
fill(255, 255 - i * 10, 0) #Reduce the amount of green
fill(255, 255 - i * 10, 0) # Reduce the amount of green
ellipse(width/2, rocket_y + i, 8, 3)

--- /code ---
Expand Down Expand Up @@ -122,8 +122,8 @@ line_highlights: 22-24
fill(255, 255 - i * 10, 0)
ellipse(width/2, rocket_y + i, 8, 3)

fill(200, 200, 200, 100) #Transparent grey
for i in range(20): #Draw 20 random smoke ellipses
fill(200, 200, 200, 100) # Transparent grey
for i in range(20): # Draw 20 random smoke ellipses
ellipse(width/2 + randint(-5, 5), rocket_y + randint(20, 50), randint(5, 10), randint(5, 10))

image(rocket, width/2, rocket_y, 64, 64)
Expand Down
10 changes: 5 additions & 5 deletions en/step_5.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ line_number_start: 7
line_highlights: 10
---

#Setup global variables
# Setup global variables
screen_size = 400
rocket_y = screen_size
burn = 100 #How much fuel is burned in each frame
burn = 100 # How much fuel is burned in each frame

--- /code ---

Expand Down Expand Up @@ -78,7 +78,7 @@ line_highlights: 15, 17-18

global rocket_y, fuel, burn
rocket_y -= 1
fuel -= burn #Burn fuel
fuel -= burn # Burn fuel
print('Fuel left: ', fuel)

--- /code ---
Expand Down Expand Up @@ -114,12 +114,12 @@ line_highlights: 17-30

global rocket_y, fuel, burn

if fuel >= burn: #Still got fuel
if fuel >= burn: # Still got fuel
rocket_y -= 1
fuel -= burn
print('Fuel left: ', fuel)

no_stroke() #Turn off the stroke
no_stroke() # Turn off the stroke

for i in range(25):
fill(255, 255 - i*10, 0)
Expand Down
30 changes: 15 additions & 15 deletions en/step_6.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ line_number_start: 7
line_highlights: 11-12
---

#Setup global variables
# Setup global variables
screen_size = 400
rocket_y = screen_size
burn = 100
Expand All @@ -57,11 +57,11 @@ line_highlights: 42-45
---

def draw_background():
background(0) #Short for background(0, 0, 0) — black
background(0) # Short for background(0, 0, 0) — black
image(planet, width/2, height, 300, 300)

no_fill() #Turn off any fill
stroke(255) #Set a white stroke
no_fill() # Turn off any fill
stroke(255) # Set a white stroke
stroke_weight(2)
ellipse(width/2, height, orbit_radius * 2, orbit_radius * 2)

Expand Down Expand Up @@ -96,12 +96,12 @@ line_number_start: 15
line_highlights: 19
---

#The draw_rocket function goes here
# The draw_rocket function goes here
def draw_rocket():

global rocket_y, fuel, burn

if fuel >= burn and rocket_y > orbit_y: #Still flying
if fuel >= burn and rocket_y > orbit_y: # Still flying

--- /code ---

Expand Down Expand Up @@ -132,8 +132,8 @@ line_highlights: 34-35
for i in range(20):
ellipse(width/2 + randint(-5, 5), rocket_y + randint(20, 50), randint(5, 10), randint(5, 10))

if fuel < burn and rocket_y > orbit_y: #No more fuel and not in orbit
tint(255, 0, 0) #Failure
if fuel < burn and rocket_y > orbit_y: # No more fuel and not in orbit
tint(255, 0, 0) # Failure

--- /code ---

Expand Down Expand Up @@ -165,10 +165,10 @@ line_highlights: 38
---

if fuel < burn and rocket_y > orbit_y:
tint(255, 0, 0) #Failure
tint(255, 0, 0) # Failure

image(rocket, width/2, rocket_y, 64, 64)
no_tint() #So the planet isn't tinted red in the next frame!
no_tint() # So the planet isn't tinted red in the next frame!


--- /code ---
Expand All @@ -189,9 +189,9 @@ line_highlights: 36-37
---

if fuel < burn and rocket_y > orbit_y:
tint(255, 0, 0) #Failure
tint(255, 0, 0) # Failure
elif rocket_y <= orbit_y:
tint(0, 255, 0) #Success
tint(0, 255, 0) # Success

image(rocket, width/2, rocket_y, 64, 64)
no_tint()
Expand Down Expand Up @@ -226,11 +226,11 @@ line_highlights: 36, 38-39
---

if fuel < burn and rocket_y > orbit_y:
tint(255, 0, 0) #Failure
tint(255, 0, 0) # Failure
elif fuel < 1000 and rocket_y <= orbit_y:
tint(0, 255, 0) #Success
tint(0, 255, 0) # Success
elif fuel >= 1000 and rocket_y <= orbit_y:
tint(255, 200, 0) #Too much fuel
tint(255, 200, 0) # Too much fuel

image(rocket, width/2, rocket_y, 64, 64)
no_tint() #So the planet isn't tinted in the next frame!
Expand Down

0 comments on commit 525e29f

Please sign in to comment.