Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys, pygame
- import time
- pygame.init()
- import random
- done=False
- finish = False
- width = 640
- height = 480
- x = 0
- y = 0
- z = 0
- speed = 8
- screen = pygame.display.set_mode((width,height))
- font = pygame.font.SysFont(None, 25)
- clock = pygame.time.Clock()
- white = (255, 255, 255)
- black = (0, 0, 0)
- light_gray = (107, 107, 107)
- gray = (39, 46, 46)
- Jet_on = pygame.image.load("jet on.png")
- one = pygame.image.load("1.png")
- two = pygame.image.load("2.png")
- three = pygame.image.load("3.png")
- four = pygame.image.load("4.png")
- five = pygame.image.load("5.png")
- six = pygame.image.load("6.png")
- seven = pygame.image.load("7.png")
- eight = pygame.image.load("8.png")
- nine = pygame.image.load("9.png")
- ten = pygame.image.load("10.png")
- list = [one,two,three,four,five,six,seven,eight,nine,ten]
- def XYZ(msg,color):
- screen_text = font.render(msg, True, color)
- screen.blit(screen_text, [0,0])
- while not finish:
- image = random.choice(list)
- print (image)
- time.sleep(5)
- while not done:
- for event in pygame.event.get():
- if event.type==pygame.QUIT:
- done=True
- keyPressed=pygame.key.get_pressed()
- screen.fill(black)
- if keyPressed[pygame.K_UP]:
- x-=speed
- if keyPressed[pygame.K_DOWN]:
- x+=speed
- if keyPressed[pygame.K_RIGHT]:
- y+=speed
- if keyPressed[pygame.K_LEFT]:
- y-=speed
- pygame.draw.polygon(screen, gray, [(0,0),(width/2,height/2),(0, 480), (0,0)])
- pygame.draw.polygon(screen, gray, [(640,0),(width/2,height/2),(640, 480), (640,0)])
- pygame.draw.polygon(screen, light_gray, [(0,0),(width/2,height/2),(640, 0), (0,0)])
- pygame.draw.polygon(screen, light_gray, [(0,480),(width/2,height/2),(640, 480), (0,480)])
- Jet_on = pygame.transform.scale(Jet_on, (160, 120))
- rect = Jet_on.get_rect()
- screen.blit(Jet_on, (y,x))
- XYZ("(x,y,z): "+str(x)+", "+str(y)+", "+str(z), white)
- if x>402:
- x=402
- if x<-10:
- x=-10
- if y<-3:
- y=-2
- if y>491:
- y=491
- image = random.choice(list), (y,x))
- rect = image.get_rect()
- screen.blit(image, (y,x))
- pygame.display.update()
- clock.tick(60)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement