Commit 3: Created watching penguins

I had a lot of fun creating the animation of walking penguins. I initially didn't understand how the frames worked
but reading the source code helped me a lot. While creating an animation I realized that I needed to
edit my static drawing functions. I still need to edit them to firther my animation. For some strange reason when running my animation,
i get the background and i need to hit enter before the animation starts playing. I don't understand why this occurs.
Is it something I did or is that just how it runs?

Commit 1: Created a static image of a penguin on an iceberg
I was struggling how to draw an oval for my penguin. I needed to look
up videos/read up how to do it. I also had to look up how to set the size of the image.
I found it really difficult to just start the penguin, but once I got the shapes
I felt more comfortable.
Commit 2: Created an iteration of penguins
Created a function penguins which iterates the drawing of the penguin until the end of the screen.
I needed to do some debugging for this to work, I managed to solve it, but I don't know how I fixed the issue. For some strange reason it's drawing the first penguin twice and I don't know why. I need to figure that out. This part was much easier than drawing out the shapes.
This commit is contained in:
ilmabura
2025-09-30 23:15:41 -04:00
parent 80073316b2
commit 23e57c7c6c
5 changed files with 64 additions and 68 deletions

View File

@@ -1,24 +1,30 @@
from drawing import *
from turtle import *
def penguins(ax):
def penguins(ax, armtilt, footangle):
background()
for x in range (ax, -500, -100):
pendown()
# Body (tall oval)
setheading(0)
# Body
draw_oval(x-60, 10, rx=28, ry=70, tilt=0, fill="black")
# Belly (smaller inner oval)
draw_oval(x-42, 12, rx=12, ry=65, tilt=0,fill="white")
# Arm (middle oval)
draw_oval(x-57, -5, rx=13, ry=30, tilt=0, fill="black")
# Head (circle = oval with equal radii)
# Belly
draw_oval(x-42, 12, rx=12, ry=65, tilt=0,fill="white", outline="darkslategray")
# Arm
draw_oval(x-65, 0, rx=10, ry=40, tilt=armtilt, fill="black", outline="darkslategray", pen= 1)
# Head
draw_oval(x-42, 80, rx=25, ry=25, fill="black")
# Beak (little triangle pointing right)
# Beak
right_triangle(x-28, 60, 25, 20, fill="gold")
# Feet (two small triangles resting on ice)
right_triangle(x-50, -60, 35, 15, fill="gold")
penup()
# Foot
right_triangle(x-50, -60, 35, 15, footangle, fill="gold")
penguins (120)
#penguin arm movement: armtilt=345
#foot movement: footangle=35
input()