Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame
- import random
- pygame.init()
- win = pygame.display.set_mode((360,740))
- pygame.display.set_caption("Piano Tiles Bootleg")
- screenX = 360
- screenY = 640
- tileW = 90
- tileH = 135
- class tile1():
- x = 0
- y = -135
- move = False
- class tile2():
- x = 90
- y = -135
- move = False
- class tile3():
- x = 180
- y = -135
- move = False
- class tile4():
- x = 270
- y = - 135
- move = False
- vel = 20
- run = True
- while run:
- pygame.time.delay(16)
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
- run = False
- randTile = random.choice([1,2,3,4])
- if randTile == 1:
- tile1.move = True
- elif randTile == 2:
- tile2.move = True
- elif randTile == 3:
- tile3.move = True
- elif randTile == 4:
- tile4.move = True
- while tile1.move:
- tile1.y += vel
- while tile2.move:
- tile2.y += vel
- while tile3.move:
- tile3.y += vel
- while tile4.move:
- tile4.y += vel
- if tile1.y > screenY:
- tile1.y = -135
- tile1.move = False
- if tile2.y > screenY:
- tile2.y = -135
- tile2.move = False
- if tile3.y > screenY:
- tile3.y = -135
- tile3.move = False
- if tile4.y > screenY:
- tile4.y = -135
- tile4.move = False
- win.fill((255,255,255))
- pygame.draw.rect(win, (0,0,0), (tile1.x, tile1.y, tileW, tileH))
- pygame.draw.rect(win, (0, 0, 0), (tile2.x, tile2.y, tileW, tileH))
- pygame.draw.rect(win, (0,0,0), (tile3.x, tile3.y, tileW, tileH))
- pygame.draw.rect(win, (0, 0, 0), (tile4.x, tile4.y, tileW, tileH))
- pygame.display.update()
- pygame.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement