generated from mwc/project_drawing
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.
31 lines
808 B
Python
31 lines
808 B
Python
from drawing import *
|
|
from turtle import *
|
|
def penguins(ax, armtilt, footangle):
|
|
background()
|
|
for x in range (ax, -500, -100):
|
|
setheading(0)
|
|
# Body
|
|
draw_oval(x-60, 10, rx=28, ry=70, tilt=0, fill="black")
|
|
# 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
|
|
right_triangle(x-28, 60, 25, 20, fill="gold")
|
|
# Foot
|
|
right_triangle(x-50, -60, 35, 15, footangle, fill="gold")
|
|
|
|
|
|
#penguin arm movement: armtilt=345
|
|
#foot movement: footangle=35
|
|
|
|
|
|
|
|
|
|
input()
|
|
|
|
|
|
|