Commit ecb1292a by BellCodeEditor

save project

parent 7834c02a
Showing with 45 additions and 8 deletions
'''time=input()
time=int(time)
s=time%60
m=time//60%60
h=time//60//60
print(h,m,s)'''
import turtle
a=input()
a=int(a)
pen=turtle.Pen()
pen.speed(1)
pen.color("black")
pen.fillcolor("red")
pen.begin_fill()
pen.forward(a)
pen.left(90)
pen.forward(a)
pen.goto(0,0)
pen.end_fill()
pen.fillcolor("yellow")
pen.begin_fill()
pen.forward(a)
pen.right(90)
pen.forward(a)
pen.goto(0,0)
pen.end_fill()
pen.hideturtle()
turtle.done()
import pygame
from pygame import locals
s="1234"
import random
score=0
# 初始化pygame,为使用硬件做准备
pygame.init()
......@@ -56,11 +57,19 @@ while True:
else:
y += 30
if x==apple_x and y==apple_y:
apple_x=randint(0,22)*30-30
apple_y=randint(0,16)*30-30
screen+=10
apple_x=random.randint(0,22)*30-30
apple_y=random.randint(0,16)*30-30
score+=10
else:
position.pop(0)
if x<0 :
x=630
if x>630:
x=0
if y<0:
y=450
if y>450:
y=0
position.append((x, y))
# 将背景图画上去
......@@ -74,9 +83,9 @@ while True:
# 将果实画上去
screen.blit(food, (apple_x,apple_y ))
# 刷新画面
pygame.display.update()
FPSCLOCK.tick(3)
\ No newline at end of file
FPSCLOCK.tick(3)
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