reduced magick numbers, changed screen update naming convenction.

This commit is contained in:
Louis Cooper 2023-07-23 19:43:48 -04:00
parent d193355daf
commit 094962996f
1 changed files with 13 additions and 7 deletions

View File

@ -129,7 +129,7 @@ def draw_tv():
rectangle(4, 29)
right(5)
end_fill()
#circle adornments
#grill adornments
fly(-260, -115)
fillcolor("#c7b199")
begin_fill()
@ -168,16 +168,22 @@ def instructions_text():
instructions_text()
#Checks for clicks inside the roung dials.
#Checks for clicks inside the round dials. Utilizes conditionals to create a button like onbject to "click" on.
def detect_circle_click(x_pos, y_pos):
if x_pos > -266.0 and x_pos < -235 and y_pos < -30.0 and y_pos > -95: #These are registering as one button, whhy, it doesnt matter for this use case but I should fix
nextScreen()
elif x_pos > -266.0 and x_pos < -235 and y_pos < -70.0 and y_pos > -99.0:
nextScreen()
top_dial_boundry_top = -30.0
top_dial_boundry_bottom = -95.0
left_dial_boundry = -266.0
right_dial_boundry = -235.0
bottom_dial_boundry_top = -70.0
bottom_dial_boundary_bottom = -99.0
if x_pos > left_dial_boundry and x_pos < right_dial_boundry and y_pos < top_dial_boundry_top and y_pos > top_dial_boundry_bottom : #These are registering as one button, whhy, it doesnt matter for this use case but I should fix
next_screen()
elif x_pos > left_dial_boundry and x_pos < right_dial_boundry and y_pos < bottom_dial_boundry_top and y_pos > bottom_dial_boundary_bottom:
next_screen()
onscreenclick(detect_circle_click)
#Selects from a random list of colors to change the screen to.
def nextScreen():
def next_screen():
hideturtle()
screen_colors = ['white', 'black', 'red', 'green', 'blue', 'cyan', 'yellow', 'magenta',
'orange', 'purple', 'pink', 'brown', 'grey', 'gold', 'lime', 'teal',