I am trying to get keyboard input on a program where the user has to move a dot around the screen. However when I run the program, the console does not come up. Could you please help me fix this error? Here is my code:
import pygame
import random
pygame.init()
x=0
y=0
xdir=5
ydir=5
r = random.randint(10,255)
g = random.randint(10,255)
b = random.randint(10,255)
screen = pygame.display.set_mode((500,300))
pygame.draw.circle(screen, (r, g, b), (x,y), 15, 0)
USI = pygame.key.get_pressed()
while True:
pygame.draw.circle(screen, (r, g, b), (x,y), 15, 0)
pygame.display.update()
if USI[pygame.K_LEFT]:
x -= 5
if USI[pygame.K_RIGHT]:
x += 5
if USI[pygame.K_UP]:
y -= 5
if USI[pygame.K_DOWN]:
y += 5