'목록하단 광고 치환자(withSeok)
728x90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from turtle import Turtle, Screen
 
def up():
    if snakes[0].heading()!=270:
        snakes[0].setheading(90)
 
screen = Screen()
screen.setup(600,600)
screen.bgcolor("khaki")
screen.title("Snake Game")
 
def create_snake(pos):
    snake_body=Turtle()
    snake_body.shape("square")
    snake_body.color("orangered")
    snake_body.up()
    snake_body.goto(pos)
    snakes.append(snake_body)
 
# snake 만들기
start_pos=[(0,0),(-20,0),(-40,0)]
snakes=[]
 
 
 
for pos in start_pos:
    create_snake(pos)
 
screen.listen()
screen.onkeypress(up, "Up")
 
game_on = True
while game_on:
 
    snakes[0].forward(10)
 
cs
728x90

+ Recent posts