generated from mwc/project_drawing
First milestone is done
I finished writing the code for the checker board, the tiles on it, and the playing coins. This part was pretty simple i was just making all the shapes i would need for the board game. Something I figured out how to do was fill in color to what I draw.
This commit is contained in:
BIN
__pycache__/shapes.cpython-313.pyc
Normal file
BIN
__pycache__/shapes.cpython-313.pyc
Normal file
Binary file not shown.
12
drawing.py
12
drawing.py
@@ -5,3 +5,15 @@
|
||||
# (Briefly describe what this program does.)
|
||||
|
||||
from turtle import *
|
||||
from shapes import board
|
||||
from shapes import black_tile
|
||||
from shapes import white_tile
|
||||
from shapes import red_coin
|
||||
from shapes import blue_coin
|
||||
|
||||
|
||||
|
||||
blue_coin(10)
|
||||
|
||||
|
||||
input()
|
||||
43
shapes.py
Normal file
43
shapes.py
Normal file
@@ -0,0 +1,43 @@
|
||||
from turtle import *
|
||||
|
||||
def board(side_length):
|
||||
"Out line of the board"
|
||||
sides = [side_length, side_length, side_length, side_length]
|
||||
for sides in sides:
|
||||
pensize(4)
|
||||
forward(sides)
|
||||
right(90)
|
||||
|
||||
|
||||
def square(size):
|
||||
"Draws a square of side length `size`"
|
||||
for side in range(4):
|
||||
forward(size)
|
||||
left(90)
|
||||
|
||||
def black_tile(size):
|
||||
begin_fill()
|
||||
fillcolor('black')
|
||||
square(size)
|
||||
end_fill()
|
||||
|
||||
|
||||
def white_tile(size):
|
||||
begin_fill()
|
||||
fillcolor('white')
|
||||
square(size)
|
||||
end_fill()
|
||||
|
||||
|
||||
def red_coin(size):
|
||||
begin_fill()
|
||||
fillcolor('red')
|
||||
circle(size)
|
||||
end_fill()
|
||||
|
||||
|
||||
def blue_coin(size):
|
||||
begin_fill()
|
||||
fillcolor('blue')
|
||||
circle(size)
|
||||
end_fill()
|
||||
Reference in New Issue
Block a user