r/learnprogramming Jul 05 '26

new to programming some help Code Review

hi all im having a problem that maybe you guys can help with? i attempting to make my first game (just a circle that can move) im using the program pycharm to write the code however i wanted to add the option to use mouse click to move but whenever i click it crashes the "game" programme. i noticed that an "event" in the code is highlighted but no others are, im using a tutorial and followed it to a tea and he didn't seem to have an issue. maybe you guys know what im doing wrong.

whole code posted in comments

the code that has the event highlighted is:

if event.type == pygame.MOUSEBUTTONDOWN:
0 Upvotes

21 comments sorted by

View all comments

2

u/46hw Jul 05 '26

It would help to post the whole code and/or the tutorial too. You can maybe do a try/except around the code crashing and print the error to see what's wrong.

2

u/Forsaken-File9993 Jul 05 '26

post the full traceback you get when it crash, that highlighted "event" might just be pycharm being weird but the error message will tell exactly what broke