made the blue piece move

I was struggling to figure out how to put the animation code into my code.
i had to change up the code for my piece so they were made separate and then move them.
it was hard to figure out have to calculate which way the piece would go but i got
one to move
This commit is contained in:
tsmith37
2025-10-04 23:58:55 -04:00
parent 7ba89f2965
commit 27fb68ccb2
5 changed files with 143 additions and 58 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -1,11 +1,27 @@
from superturtle.animation import animate
from turtle import forward, right
from shapes import red_coin
from turtle import *
from shapes import *
def square(side_length):
for side in range(4):
forward(side_length)
right(90)
for frame in animate(40, loop=True):
size = frame.interpolate(50, 100, mirror=True)
square(size)
for frame in animate(30):
penup()
forward(100)
pendown()
black_tile(40)
with frame.translate([-275, -150], [-225, -100]):
red_coin(20)
goto(-175, -150)
blue_coin(25)
input()
# for frame in animate(frames=30):
# with frame.translate([0, 0], [100, 100]):
# red_coin(25)
input()

View File

@@ -4,12 +4,14 @@
#
# (Briefly describe what this program does.)
from superturtle.animation import animate
from turtle import *
from shapes import board
from shapes import blue_coin
from shapes import red_coin
from shapes import black_tile
from shapes import game
from shapes import *
def flyto(x, y):
penup()
@@ -41,7 +43,7 @@ def red_row(times):
penup()
forward(size * 2)
def game(times):
penup()
goto(-300, 200)
pendown()
@@ -84,22 +86,36 @@ sizes = [50,50,50,50]
black_row(1)
flyto(-300, -200)
"blue checkers piece"
for frame in animate(40):
game(1)
forward(75)
blue_row(1)
flyto(-300, -150)
forward(25)
blue_row(1)
flyto(-275, -150)
blue_coin(25)
flyto(-175, -150)
blue_coin(25)
flyto(-75, -150)
blue_coin(25)
flyto(25, -150)
with frame.translate([0, 0], [50, 50]):
blue_coin(25)
flyto(-275, 150)
red_row(1)
flyto(-300, 100)
"red checkers piece"
forward(75)
red_row(1)
flyto(-300, 150)
forward(25)
red_row(1)
red_coin(25)
flyto(-125, 100)
red_coin(25)
flyto(-25, 100)
red_coin(25)
flyto(75, 100)
red_coin(25)
flyto(-300, 200)
input()

View File

@@ -30,3 +30,56 @@ def black_tile(size):
right(90)
def black_row(times):
sizes = [50,50,50,50]
for size in sizes:
begin_fill()
fillcolor('black')
black_tile(size)
end_fill()
penup()
forward(size * 2)
pendown()
def game(times):
penup()
goto(-300, 200)
pendown()
board(400)
"first row"
black_row(1)
flyto(-300, 150)
forward(50)
"second row - white tile first"
black_row(1)
flyto(-300, 100)
"third row - black tile first"
black_row(1)
flyto(-300, 50)
forward(50)
"fourth row - white tile first"
black_row(1)
flyto(-300, 0)
"five row - black tile first"
black_row(1)
flyto(-300, -50)
forward(50)
"six row - white tile first"
black_row(1)
flyto(-300, -100)
"seven row - black tile first"
black_row(1)
flyto(-300, -150)
forward(50)
"eight row - white tile first"
sizes = [50,50,50,50]
black_row(1)
flyto(-300, -200)