Deqin,进德勤一般要什么学历
1.0
import pygame
pygame.init()
screen = pygame.display.set_mode((600, 500))
ball_x = 300
ball_y = 250
while True:
screen.fill((0, 0, 0))
ball_y = ball_y + 1
if ball_y>500:
ball_y=250
pygame.draw.circle(screen, (20, 175, 222), (ball_x,ball_y), 50 )
pygame.display.update()
2.0
import pygame
pygame.init()
screen = pygame.display.set_mode((666, 500))
pygame.display.set_caption("蔡旭坤接小球")
ball_x = 333
ball_y = 166
down = 1
up = 2
left = 3
right = 4
rect_x,rect_y,rect_w,rect_h = 300,460,120,40
while True:
for event in pygame.event.get():
print(event)
if event.type == pygame.QUIT:
pygame.quit()
screen.fill((100, 200, 0))
pygame.draw.circle(screen, (20, 40, 60), (ball_x, ball_y), 50)
pygame.draw.rect(screen, (30,90,60), (rect_x,rect_y,rect_w,rect_h))
direction = input("请输入数字1234")
direction = int(direction)
if down == direction:
ball_y += 10
if ball_y > 333:
ball_y = 166
elif up == direction:
pygame.draw.circle(screen, (20, 40, 60), (ball_x, ball_y), 50)
ball_y = ball_y - 10
if ball_y < 0:
ball_y = 166
elif left == direction:
pygame.draw.circle(screen, (20, 40, 60), (ball_x, ball_y), 50)
ball_x = ball_x - 10
if ball_x < 0:
ball_x = 166
elif right == direction:
pygame.draw.circle(screen, (20, 40, 60), (ball_x, ball_y), 50)
ball_x = ball_x + 10
if ball_x > 666:
ball_x = 166
else:
print("系统未升级")
pygame.draw.circle(screen, (255, 255, 255), (ball_x, ball_y), 50)
pygame.display.update()
pygame.quit()
文章最后发布于: 2019-10-25 19:49:39
评论暂时关闭