터틀 그래픽에서 어몽어스(among us) 그림 그리기를 해보자. 방식은 forward(), circle() 등을 이용하는 그림이기에 코드 자체는 정말 간단하게 이해할 수 있다.
Table of Contents
어몽어스(among us) 그림 그리기
![[파이썬] 어몽어스(among us) 그림 그리기 (with 터틀 그래픽) 1 어몽어스(among us) 그림 그리기](https://www.shindeacon.co.kr/wp-content/uploads/2023/11/AmongUs-optimized.png)
주 사용되는 함수
– turtle.pensize() : 터틀이 그리는 선의 굵기
– turtle.fillcolor() : 채우기 색상 설정
– turtle.right() : 터틀을 오른쪽으로 회전 시키기
– turtle.left() : 터틀을 왼쪽으로 회전 시키기
– turtle.circle() : 터틀이 위치한 자리에서 왼쪽 방향으로 원을 그리기
최종 스크립트
import turtle as t
t.setup(500, 700)
body_color = 'red'
glacss_color = 'skyblue'
# 몸 그리기
def body():
t.pensize(20)
t.fillcolor(body_color)
t.begin_fill()
t.right(90)
t.forward(50)
t.right(180)
t.circle(40, -180)
t.right(180)
t.forward(200)
t.right(180)
t.circle(100, -180)
t.backward(20)
t.left(15)
t.circle(500, -20)
t.backward(20)
t.circle(40, -180)
t.left(7)
t.backward(50)
t.penup()
t.left(90)
t.forward(10)
t.right(90)
t.pendown()
t.right(240)
t.circle(50, -70)
t.end_fill()
# 글래스 그리기
def glass():
t.penup()
t.right(230)
t.forward(100)
t.left(90)
t.forward(20)
t.right(90)
t.pendown()
t.fillcolor(glacss_color)
t.begin_fill()
t.right(150)
t.circle(90, -55)
t.right(180)
t.forward(1)
t.right(180)
t.circle(10, -65)
t.right(180)
t.forward(110)
t.right(180)
t.circle(50, -190)
t.right(170)
t.forward(80)
t.right(180)
t.circle(45, -30)
t.end_fill()
# 어몽어스 가방 그리기
def Bag():
t.penup()
t.right(60)
t.forward(100)
t.right(90)
t.forward(75)
t.fillcolor(body_color)
t.begin_fill()
t.pendown()
t.forward(30)
t.right(255)
t.circle(300, -30)
t.right(260)
t.forward(30)
t.end_fill()
body()
glass()
Bag()
t.ht() # 마지막 터틀을 숨김
t.mainloop()