Commit 2b884c94 by BellCodeEditor

save project

parent dd4210cc
Showing with 12 additions and 3 deletions
from pygame import *; from pygame import *;
import random;
import sys; import sys;
positionX = 120; setHeadingString = "right"
positionY = 240; playerX = 0
playerY = 0
position = [(playerX, playerY)]
# 初始化pygame,为使用pygame做准备 # 初始化pygame,为使用pygame做准备
init(); init();
...@@ -13,13 +17,18 @@ snake = image.load('right.png'); ...@@ -13,13 +17,18 @@ snake = image.load('right.png');
body = image.load('body.png'); body = image.load('body.png');
apple = image.load('apple.png'); apple = image.load('apple.png');
setHeading = snake
# 创建一个窗口 # 创建一个窗口
screen = display.set_mode((800, 600)); screen = display.set_mode((660, 480));
while 1: while 1:
for events in event.get(): for events in event.get():
if events.type == QUIT: if events.type == QUIT:
sys.exit(); sys.exit();
if events.type == KEYDOWN:
if events.key == K_w:
screen.blit(background, (0, 0)); screen.blit(background, (0, 0));
screen.blit(snake, (240, 120)); screen.blit(snake, (240, 120));
......
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