Nice day for y'all, peoples
after learning python i'm starting to learn pygame, and for thaat i've been tried to make my first step by doing a rect to move. I did draw the rect and did the following code:
import pygame
pygame.init()
win = pygame.display.set_mode((500, 500))
pygame.display.set_caption("First Game")
clock = pygame.time.Clock()
rectx = 100
recty = 250
run = True
player = pygame.draw.rect(win, (255, 255, 255), pygame.Rect(rectx, recty, 100, 60))
pygame.display.flip()
while run:
clock.tick(60)
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
key_pressed_is = pygame.key.get_pressed()
if pygame.K_LEFT:
rectx -= 8
if pygame.K_RIGHT:
rectx += 8
if pygame.K_UP:
recty -= 8
if pygame.K_DOWN:
recty += 8
pygame.display.update()
but when i run the program, everything is okay except that the rect doens't move. Even when i press any move button, it doens't move and i don't get eny error message, the rect just stay still
what should i do? and if it is possible, could you explain me why i get that error?