well it's been a while since I did pygame but hopefully this is kinda right,
python code:
import pygame
from pygame.locals import *
class Mover(pygame.sprite.Sprite):
"""moves a clenched fist on the screen, following the mouse"""
def __init__(self):
pygame.sprite.Sprite.__init__(self) #call Sprite initializer
def update(self):
"move the fist based on the mouse position"
pos = pygame.mouse.get_pos()
if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE):
return
elif event.type == KEYDOWN: # Verify pressed keys
key = pygame.key.get_pressed()
if key[K_UP] and key[K_RIGHT]:
print 'AD'
elif key[K_UP] and key[K_LEFT]:
print 'AE'
elif key[K_DOWN] and key[K_RIGHT]:
print 'RD'
elif key[K_DOWN] and key[K_LEFT]:
print 'RE'
elif key[K_UP]:
print 'Ax'
elif key[K_DOWN]:
print 'Rx'
elif key[K_RIGHT]:
print 'xD'
elif key[K_LEFT]:
print 'xE'
self.rect.move_ip(5, 10)
def main():
pygame.init()
screen = pygame.display.set_mode((75, 55))
screen = pygame.display.set_caption('Projeto 39')
screen = pygame.display.get_surface()
background = pygame.Surface(screen.get_size())
background = background.convert()
background.fill((250, 255, 255))
screen.blit(background, (0, 0))
m=Mover()
screen.blit(background, (0, 0))
pygame.display.flip()
main()
note: I haven't tested that but I think that's how pygame does it