I wrote a program using all pygame modules. Some of it looks like this:
#assigning keys to the key press library
keys = pygame.key.get_pressed()
#Key movements
if keys[pygame.K_w] or keys[pygame.K_UP]:
c_one_y -= speed
if keys[pygame.K_s] or keys[pygame.K_DOWN]:
c_one_y += speed
if keys[pygame.K_a] or keys[pygame.K_LEFT]:
c_one_x -= speed
if keys[pygame.K_d] or keys[pygame.K_RIGHT]:
c_one_x += speed
screen.fill(maincolour)
pygame.draw.rect(screen, (225, 0, 0), (c_one_x, c_one_y, width, length))
pygame.display.update
The aim is to move a rectangle in any direction using wasd's and the arrow keys. My IDE isn't reporting any errors yet the rectangle isn't appearing where it is set to. I have tried various different approaches to the problem but none have worked. Got any suggestions?