Ask coding questions

← Back to all posts
I need help with a pause button
LiamBerube (5)

I need help with a pause button because I am new to pygame and just someone to tell me the simplest way to do this so that it doesn't go way over my head and I understand it would be great. Thanks! :P

MaciahLawson (32)

I'm pretty sure this is how you do it. (I haven't done pygame in a while so pls lemme know if this works)...

for e in pygame.event.get():
if e.type == pygame.QUIT: break
if e.type == pygame.KEYDOWN:
if e.key == pygame.K_p: state = PAUSE
if e.key == pygame.K_s: state = RUNNING...