Skip to content

Commit

Permalink
Indentation and Comment fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pjbRPF committed Jul 14, 2023
1 parent a2ab79c commit 00fc040
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 95 deletions.
22 changes: 11 additions & 11 deletions en/step_2.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ line_highlights: 20
---

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


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

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


--- /code ---
Expand Down Expand Up @@ -127,8 +127,8 @@ line_highlights: 15-17

# 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,8 +151,8 @@ line_highlights: 30
---

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

--- /code ---

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

def setup():
# Setup your animation here
size(screen_size, screen_size)
image_mode(CENTER)
global planet, rocket
planet = load_image('planet.png')
rocket = load_image('rocket.png')
# Setup your animation here
size(screen_size, screen_size)
image_mode(CENTER)
global planet, rocket
planet = load_image('planet.png')
rocket = load_image('rocket.png')

--- /code ---

Expand Down Expand Up @@ -86,9 +86,9 @@ line_highlights: 12-16

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


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

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


--- /code ---
Expand Down
36 changes: 18 additions & 18 deletions en/step_4.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ line_highlights: 16-20
---

def draw_rocket():
global rocket_y
rocket_y -= 1
global rocket_y
rocket_y -= 1

no_stroke() #Turn off the stroke
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)
image(rocket, width/2, rocket_y, 64, 64)


--- /code ---
Expand Down Expand Up @@ -83,9 +83,9 @@ line_number_start: 18
line_highlights: 19
---

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

--- /code ---

Expand Down Expand Up @@ -118,15 +118,15 @@ line_number_start: 18
line_highlights: 22-24
---

for i in range(25):
fill(255, 255 - i * 10, 0)
ellipse(width/2, rocket_y + i, 8, 3)
for i in range(25):
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
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)
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)

--- /code ---

Expand Down
44 changes: 22 additions & 22 deletions en/step_5.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ line_number_start: 15
line_highlights: 15, 17-18
---

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

--- /code ---

Expand Down Expand Up @@ -112,24 +112,24 @@ line_number_start: 15
line_highlights: 17-30
---

global rocket_y, fuel, burn

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

no_stroke() # Turn off the stroke

for i in range(25):
fill(255, 255 - i*10, 0)
ellipse(width/2, rocket_y + i, 8, 3)

fill(200, 200, 200, 100)
for i in range(20):
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)
global rocket_y, fuel, burn

if fuel >= burn: # Still got fuel
rocket_y -= 1
fuel -= burn
print('Fuel left: ', fuel)
no_stroke() # Turn off the stroke
for i in range(25):
fill(255, 255 - i*10, 0)
ellipse(width/2, rocket_y + i, 8, 3)
fill(200, 200, 200, 100)
for i in range(20):
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)

--- /code ---

Expand Down
63 changes: 31 additions & 32 deletions en/step_6.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ line_highlights: 42-45
---

def draw_background():
background(0) # Short for background(0, 0, 0) — black
image(planet, width/2, height, 300, 300)
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
stroke_weight(2)
ellipse(width/2, height, orbit_radius * 2, orbit_radius * 2)
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)

--- /code ---

Expand Down Expand Up @@ -98,10 +98,9 @@ line_highlights: 19

# The draw_rocket function goes here
def draw_rocket():

global rocket_y, fuel, burn

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

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

--- /code ---

Expand Down Expand Up @@ -130,10 +129,10 @@ line_highlights: 34-35

fill(200, 200, 200, 100)
for i in range(20):
ellipse(width/2 + randint(-5, 5), rocket_y + randint(20, 50), randint(5, 10), randint(5, 10))
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 @@ -164,11 +163,11 @@ line_number_start: 34
line_highlights: 38
---

if fuel < burn and rocket_y > orbit_y:
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!
if fuel < burn and rocket_y > orbit_y:
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!


--- /code ---
Expand All @@ -188,13 +187,13 @@ line_number_start: 34
line_highlights: 36-37
---

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

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

--- /code ---

Expand Down Expand Up @@ -225,15 +224,15 @@ line_number_start: 34
line_highlights: 36, 38-39
---

if fuel < burn and rocket_y > orbit_y:
tint(255, 0, 0) # Failure
elif fuel < 1000 and rocket_y <= orbit_y:
tint(0, 255, 0) # Success
elif fuel >= 1000 and rocket_y <= orbit_y:
tint(255, 200, 0) # Too much fuel
if fuel < burn and rocket_y > orbit_y:
tint(255, 0, 0) # Failure
elif fuel < 1000 and rocket_y <= orbit_y:
tint(0, 255, 0) # Success
elif fuel >= 1000 and rocket_y <= orbit_y:
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!
image(rocket, width/2, rocket_y, 64, 64)
no_tint() # So the planet isn't tinted in the next frame!

--- /code ---

Expand Down

0 comments on commit 00fc040

Please sign in to comment.