From 1bf68ab5036938a9d92676c16343ac1c673e1360 Mon Sep 17 00:00:00 2001 From: Justin Toombs Date: Sun, 23 Jul 2023 20:59:28 -0400 Subject: [PATCH] I have taken the d-pad as defined in my previous submission and created a function to encapsulate it. This wasn't as difficult as I made it out to be as I was still attempting to fully understand the concept. I realized that I could define the function as what I was making. When I figured this out, the rest came to me and I was able to reorganize my shape to fit inside the function. Much of getting it to work was trial-and-error, and as such it felt earned to figure it out. My next major step involves making an attempt to introduce an argument into the function, and specifically allow for my d-pad to scale in size in order to make either a smaller d-pad inside of the current one or to even offset for a bit of a 3D effect. --- drawing.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/drawing.py b/drawing.py index e2d0b0b..71284bf 100644 --- a/drawing.py +++ b/drawing.py @@ -6,21 +6,21 @@ from turtle import * import turtle - -screen = turtle.Screen() -screen.setup(1000,1000) -turtle.color('blue') - -turtle.up() -turtle.goto(-450,-150) -turtle.down() -turtle.begin_fill() -for _ in range(4): - turtle.fd(300) - turtle.right(90) - turtle.fd(300) - turtle.left(90) - turtle.fd(300) - turtle.left(90) -turtle.end_fill() +def dpad(): + screen = turtle.Screen() + screen.setup(1000,1000) + turtle.color('blue') + turtle.up() + turtle.goto(-450,-150) + turtle.down() + turtle.begin_fill() + for _ in range(4): + turtle.fd(300) + turtle.right(90) + turtle.fd(300) + turtle.left(90) + turtle.fd(300) + turtle.left(90) + turtle.end_fill() +dpad() done() \ No newline at end of file