I'm kinda new to Pygame and I'm looking to start a new small project, I've only really done one before but I'm stuck on it. There's a small rectangle at the bottom of the screen and the idea is to have it move. I don't have any syntax errors showing but nothing is happening. the code is below:
import pygame
pygame.init()
x = 190
vel = 5
screen = pygame.display.set_mode((400, 400))
while True:
keys = pygame.key.get_pressed()
if keys[pygame.K_RIGHT]:
x -= vel
if keys[pygame.K_RIGHT]:
x += vel
bg = (50,50,50)
white = (255,255,255)
screen.fill(bg)
pygame.draw.rect(screen, white, pygame.Rect(x, 390, 20, 10))
pygame.display.update()
When I run the code it should have it so that the rectangle moves left and right in increments of 5 pixels, but nothing happens.