Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/tasks/project_components/target_practice_example/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@

# The mouse_pressed function goes here
def mouse_pressed():
if hit_color == Color('blue'): # Like functions, 'if' statements are indented
if hit_colour == Color('blue'): # Like functions, 'if' statements are indented
print('You hit the outer circle, 50 points!')
elif hit_color == Color('red'):
elif hit_colour == Color('red'):
print('You hit the inner circle, 200 points!')
elif hit_color == Color('yellow'):
elif hit_colour == Color('yellow'):
print('You hit the middle, 500 points!')
else:
print('You missed! No points!')

# The shoot_arrow function goes here
def shoot_arrow():
global hit_color # Can be used in other functions
global hit_colour # Can be used in other functions
arrow_x = randint(100, 300) # Store a random number between 100 and 300
arrow_y = randint(100, 300) # Store a random number between 100 and 300
hit_color = get(arrow_x, arrow_y) # Get the hit colour
hit_colour = get(arrow_x, arrow_y) # Get the hit colour
fill('sienna') # Set the arrow to fill colour to brown
circle(arrow_x, arrow_y, 15) # Draw a small circle at random coordinates

Expand All @@ -40,7 +40,7 @@ def draw():
fill('red')
circle(200, 200, 110) # Inner circle
fill('yellow')
circle(200, 200, 30) # Middle
circle(200, 200, 30) # Middle circle
shoot_arrow()

# Keep this to run your code
Expand Down
139 changes: 0 additions & 139 deletions lib/tasks/project_components/target_practice_example/p5.py

This file was deleted.

6 changes: 3 additions & 3 deletions lib/tasks/project_components/target_practice_starter/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

def setup():
# Setup your game here
size(400, 400) # width and height
size(400, 400) # width and height of screen

def draw():
# Things to do in every frame
fill('cyan')
rect(0, 0, 400, 250) # Sky
fill('cyan') # Set the fill color for the sky to cyan
rect(0, 0, 400, 250) # Draw a rectangle for the sky with these values for x, y, width, height

# Keep this to run your code
run(frame_rate=2)