Ask coding questions

← Back to all posts
How come keyboard input wont move my rectangle?
LukeNorris

Ive been following a tutorial to brief myself on pygame and I am having trouble getting this part to work, even when code is identical to the tutorial.

https://realpython.com/pygame-a-primer/

thanks in advance :)

Voters
LukeNorris
Comments
hotnewtop
LukeNorris

turns out that I wasnt casting the rectangle to the actual player class.

CodeMaster007

When I run the code, it seems to work.

LukeNorris

@CodeMaster007 thanks for the response, Im fairly new to running pygame inside of replit. What do you click on before you input your movement keys?

MrVoo

I cant test it on this device, but if you're typing in the console then that's why