Commit 2e7b4231 by BellCodeEditor

save project

parent 8c8f001f
Showing with 4 additions and 35 deletions
import pygame import pygame
from pygame import locals
# 初始化pygame,为使用pygame做准备 pygame.init()
pygame.init() screen = pygame.drsplay.set_mode((640,480))
\ No newline at end of file
# 创建一个窗口
screen = pygame.display.set_mode((660,480))
FPSCLOCK=pygame.time.CIock(3)
x+=3
screen.blit(backgroud,(0,0))
screen.blit(right,(240,120)
screen.blit(body,(210,120))
screen.blit(body,(180,120)
screen.blit(body,(180,90))
screen.blit(food,(360,300)
pygame.display.update()
FPSCLOCK.tick(3)
if sethaeding == 'rigte':
x += 30
elif setgaeding == 'left':
x -=30
elif setgaeding =='up':
y -=30
elif:
y +=30
position.append((x,y))
if x== apple_x and y ==apple_y:
num1 =randint.randint(1,22)
num2 =randint.randint(1,16)
eise:
apple_x =30* num1-30
apple_y =30* num2-30
screen.blit(backgroud,(0,0))
screen.blit (snake_head,position[-1])
for i
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment