generated from mwc/project_drawing
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:
118
drawing.py
118
drawing.py
@@ -4,19 +4,21 @@
|
||||
#
|
||||
# (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()
|
||||
penup()
|
||||
goto(x, y)
|
||||
pendown()
|
||||
|
||||
def black_row(times):
|
||||
def black_row(times):
|
||||
sizes = [50,50,50,50]
|
||||
for size in sizes:
|
||||
begin_fill()
|
||||
@@ -41,65 +43,79 @@ def red_row(times):
|
||||
penup()
|
||||
forward(size * 2)
|
||||
|
||||
def game(times):
|
||||
penup()
|
||||
goto(-300, 200)
|
||||
pendown()
|
||||
board(400)
|
||||
|
||||
penup()
|
||||
goto(-300, 200)
|
||||
pendown()
|
||||
board(400)
|
||||
"first row"
|
||||
black_row(1)
|
||||
flyto(-300, 150)
|
||||
forward(50)
|
||||
|
||||
"first row"
|
||||
black_row(1)
|
||||
flyto(-300, 150)
|
||||
forward(50)
|
||||
"second row - white tile first"
|
||||
black_row(1)
|
||||
flyto(-300, 100)
|
||||
|
||||
"second row - white tile first"
|
||||
black_row(1)
|
||||
flyto(-300, 100)
|
||||
"third row - black tile first"
|
||||
black_row(1)
|
||||
flyto(-300, 50)
|
||||
forward(50)
|
||||
|
||||
"third row - black tile first"
|
||||
black_row(1)
|
||||
flyto(-300, 50)
|
||||
forward(50)
|
||||
"fourth row - white tile first"
|
||||
black_row(1)
|
||||
flyto(-300, 0)
|
||||
|
||||
"fourth row - white tile first"
|
||||
black_row(1)
|
||||
flyto(-300, 0)
|
||||
"five row - black tile first"
|
||||
black_row(1)
|
||||
flyto(-300, -50)
|
||||
forward(50)
|
||||
|
||||
"five row - black tile first"
|
||||
black_row(1)
|
||||
flyto(-300, -50)
|
||||
forward(50)
|
||||
"six row - white tile first"
|
||||
black_row(1)
|
||||
flyto(-300, -100)
|
||||
|
||||
"six row - white tile first"
|
||||
black_row(1)
|
||||
flyto(-300, -100)
|
||||
"seven row - black tile first"
|
||||
black_row(1)
|
||||
flyto(-300, -150)
|
||||
forward(50)
|
||||
|
||||
"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)
|
||||
|
||||
"eight row - white tile first"
|
||||
sizes = [50,50,50,50]
|
||||
black_row(1)
|
||||
flyto(-300, -200)
|
||||
|
||||
"blue checkers piece"
|
||||
forward(75)
|
||||
blue_row(1)
|
||||
flyto(-300, -150)
|
||||
forward(25)
|
||||
blue_row(1)
|
||||
flyto(-300, 100)
|
||||
|
||||
"red checkers piece"
|
||||
forward(75)
|
||||
red_row(1)
|
||||
flyto(-300, 150)
|
||||
forward(25)
|
||||
red_row(1)
|
||||
flyto(-300, 200)
|
||||
for frame in animate(40):
|
||||
|
||||
game(1)
|
||||
|
||||
forward(75)
|
||||
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)
|
||||
forward(75)
|
||||
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()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user