Commit e11910af by BellCodeEditor

auto save

parent 493a98ab
apple.png

2.05 KB

bg.png

22.5 KB

body.png

1.4 KB

......@@ -4,11 +4,11 @@
scores = {'语文':89, '数学':95, '英语':80}
def get_average(scores):
score = 0
sum = 0
for subject, score in scores.items():
score += score
print('现在的总分是%d'%score)
ave_score = score/len(scores)
sum+=score
print('现在的总分是%d'%sum)
ave_score =sum/len(scores)
print('平均分是%d'%ave_score)
get_average(scores)
\ No newline at end of file
tt=0
for i in range(1,1001):
tt=tt+i
print(tt)
\ No newline at end of file
# import pygame
# pygame.init()
# a=pygame.display.set_mode((800,600))
# b=pygame.image.load('apple.png')
# c=pygame.image.load('body.png')
# while True:
# for i in pygame.event.get():
# if i.type==pygame.QUIT:
# pygame.display.quit()
# a=pygame.display.set_mode((800,600))
# a.blit(b,(30,30))
# pygame.display.update()
import pygame
import sys
pygame.init()
screen = pygame.display.set_mode((10,10),0)
a= pygame.display.set_mode((800,800),0)
screen.fill((0,255,255))
pygame.display.update()
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit(0)
down.png

2.01 KB

left.png

2.07 KB

File added
import pygame
import multiprocessing
from time import sleep
def init():
pygame.init()
screen = pygame.display.set_mode((320,240))
return screen
def main():
screen = init()
while True:
pygame.event.pump()
event = pygame.event.poll()
if event.type != pygame.NOEVENT:
print event
class Multigame(multiprocessing.Process):
def run(self):
return main()
for i in range(3):
Multigame().start()
while True:
sleep(1)
\ No newline at end of file
right.png

2.05 KB

import pygame
from pygame import locals
# 初始化pygame,为使用硬件做准备
pygame.init()
# 创建一个窗口
screen = pygame.display.set_mode((660, 480))
kk=pygame.time.Clock()
# 背景
background = pygame.image.load('bg.png')
right = pygame.image.load('right.png')
food = pygame.image.load('apple.png')
body = pygame.image.load('body.png')
x,y=240,120
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
# 接收到退出事件后退出程序
exit()
# 将背景图画上去
screen.blit(background, (0, 0))
# 将贪吃蛇画上去
x+=30
screen.blit(right, (x, y))
# 将贪吃蛇的身体画上去
screen.blit(body, (210, 120))
screen.blit(body, (180, 120))
screen.blit(body, (180, 90))
# 将果实画上去
screen.blit(food, (360, 300))
# 刷新画面
pygame.display.update()
kk.tick(3)
\ No newline at end of file
up.png

2.05 KB

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