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:
		
							
								
								
									
										
											BIN
										
									
								
								__pycache__/drawing.cpython-313.pyc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								__pycache__/drawing.cpython-313.pyc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -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()
 | 
			
		||||
							
								
								
									
										112
									
								
								drawing.py
									
									
									
									
									
								
							
							
						
						
									
										112
									
								
								drawing.py
									
									
									
									
									
								
							@@ -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,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)
 | 
			
		||||
for frame in animate(40):
 | 
			
		||||
    
 | 
			
		||||
"red checkers piece"
 | 
			
		||||
forward(75)
 | 
			
		||||
red_row(1)
 | 
			
		||||
flyto(-300, 150)
 | 
			
		||||
forward(25)
 | 
			
		||||
red_row(1)
 | 
			
		||||
flyto(-300, 200)
 | 
			
		||||
        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()
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										53
									
								
								shapes.py
									
									
									
									
									
								
							
							
						
						
									
										53
									
								
								shapes.py
									
									
									
									
									
								
							@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user