from pygame import * # This used to be pressalot, but now it's not - sorry! init() screen = display.set_mode((700, 1024)) class Player: def __init__(self): self.sprite = image.load("tank.png") self.rect = self.sprite.get_rect() self.vx = 0 self.vy = 0 def update_and_display(self): print self.vx # self.rect.centerx += self.vx # self.rect.centery += self.vy screen.blit(self.sprite, self.rect) p = Player() # Main Loop while True: # Event processing (keys) for e in event.get(): if e.type == KEYDOWN: if e.key == K_RIGHT: p.vx = 5 if e.key == K_LEFT: p.vx = -5 if e.key == K_UP: p.vy = 5 if e.key == K_DOWN: p.vy = 5 print p.rect.centerx, p.rect.centery if e.type == QUIT: from sys import exit exit() # Update positions and display screen.fill((255, 255, 255)) p.update_and_display() display.flip()