diff --git a/__pycache__/drawing.cpython-313.pyc b/__pycache__/drawing.cpython-313.pyc new file mode 100644 index 0000000..f239432 Binary files /dev/null and b/__pycache__/drawing.cpython-313.pyc differ diff --git a/__pycache__/shapes.cpython-313.pyc b/__pycache__/shapes.cpython-313.pyc index 44f8bba..1433bec 100644 Binary files a/__pycache__/shapes.cpython-313.pyc and b/__pycache__/shapes.cpython-313.pyc differ diff --git a/animation_test.py b/animation_test.py index 4fa7855..2a04b00 100644 --- a/animation_test.py +++ b/animation_test.py @@ -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) \ No newline at end of file + +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() \ No newline at end of file diff --git a/drawing.py b/drawing.py index 36013b4..51087e9 100644 --- a/drawing.py +++ b/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() diff --git a/shapes.py b/shapes.py index 64da5b7..727c88d 100644 --- a/shapes.py +++ b/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)