Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to import and use keyboard with pygame

keys=pygame.key.get_pressed()
if keys[K_LEFT]:
    location-=1
    if location==-1:
        location=0
if keys[K_RIGHT]:
    location+=1
    if location==5:
        location=4
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #import #keyboard #pygame
ADD COMMENT
Topic
Name
9+6 =