Skip to content
← Back to Community
How to use arrow keys?
Profile icon
BlueComet

I'm want to create a game using arrow keys. Is there a way to use arrow keys in python?

Voters
Profile icon
BlueComet
Comments
hotnewtop
Profile icon
SixBeeps

Take a look at this SO question
I don't know what Repl.it uses for the keys, but you can give it a try.

Profile icon
BlueComet

@SixBeeps I don't really understand that

Profile icon
mwilki7

Use a pygame repl.
Feel free to fork this one:
https://repl.it/@mwilki7/pygame-examples

Profile icon
BlueComet

@mwilki7 thanks this will help. And I'm going to make a maze game do you know what approach I should take?

Profile icon
mwilki7

@BlueComet
you can use an array for the maze
I would draw a box for each wall, and maybe draw a different colored box for the player

arrow keys could modify the player's position

Profile icon
BlueComet

ok @mwilki7 thanks