How do we recognize the WASD keys? You are right! Just like any other event.
The only change in the code is to recognize the WASD key press.
Change the “if” condition to-
if(user_input[pygame.K_UP] or user_input[pygame.K_w]): Y=Y-1 if(Y<0):Y=SCREENHEIGHT elif(user_input[pygame.K_DOWN] or user_input[pygame.K_s]): Y=Y+1 if(Y>SCREENHEIGHT):Y=0 elif(user_input[pygame.K_LEFT] or user_input[pygame.K_a]): X=X-1 if(X<0):X=SCREENWIDTH elif(user_input[pygame.K_RIGHT] or user_input[pygame.K_d]): X=X+1 if(X>SCREENWIDTH):X=0
Now on to some actual gaming! Games usually involve one object colliding with another and scoring points. Let us collide our circle with a square next and see what can be done! Whoa! We have reached so far and we are only a little away from creating a full fledged simple game.