Search Results

Search found 1 results on 1 pages for 'user1821449'.

Page 1/1 | 1 

  • I am trying to move a rectangle in Pygame using coordinates but won't work

    - by user1821449
    this is my code import pygame from pygame.locals import * import sys pygame.init() pygame.display.set_caption("*no current mission*") size = (1280, 750) screen = pygame.display.set_mode(size) clock = pygame.time.Clock() bg = pygame.image.load("bg1.png") guy = pygame.image.load("hero_stand.png") rect = guy.get_rect() x = 10 y = 10 while True: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() if event.type == KEYDOWN: _if event.key == K_RIGHT: x += 5 rect.move(x,y)_ rect.move(x,y) screen.blit(bg,(0,0)) screen.blit(guy, rect) pygame.display.flip() it is just a simple test to see if i can get a rectangle to move. Everything seems to work except the code I put in italic.

    Read the article

1