import pygame, os, sys
from pygame.locals import *
#starting x and y cords for blocks to start at
sx = 183
sy = 24
#load the block images
L = pygame.image.load('L.bmp')
straight = pygame.image.load('straight.bmp')
#Create and initialize the clock
clock = pygame.time.Clock()
#initialize pygame
pygame.init()
screen = pygame.display.set_mode((400, 600))
pygame.display.set_caption('!!TETRIS REVENGE!!')
#background
background = pygame.image.load('back.bmp')
screen.blit(background,(0,0))
#function to handle block creation and movement
def blockfall():
global sx
global sy
screen.blit(L,(sx,sy))
if sy < 560:
sy = sy + 1
return sx
#Function to handle all input
def iput():
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
#if event.type == pygame.KEYDOWN:
K_LEFT = sx = sx - 1
K_RIGHT = sx = sx + 1
#main loop
while True:
iput()
blockfall()
pygame.display.flip()
clock.tick(70)