finishing up the last game in the video tutorial I have been using to learn python/pygame coding.
When I ran the game, the following error is showing:
File "/home/dev/PycharmProjects/game7_meteor_game/game7_meteor_game.py", line 82, in GameInterface
if player.cooling_time > 0:
UnboundLocalError: local variable 'player' referenced before assignment.
I have absolutely no idea at all what this means or how to correct it considering it is EXACTLY like the source code I got as part of the learning material.
Traceback:
Traceback (most recent call last):
File "/home/dev/PycharmProjects/game7_meteor_game/game7_meteor_game.py", line 160, in <module>
main()
File "/home/dev/PycharmProjects/game7_meteor_game/game7_meteor_game.py", line 152, in main
GameInterface(num_player=1, screen=screen)
File "/home/dev/PycharmProjects/game7_meteor_game/game7_meteor_game.py", line 82, in GameInterface
if player.cooling_time > 0:
UnboundLocalError: local variable 'player' referenced before assignment
My code:
---->if player.cooling_time > 0:
player.cooling_time -= 1<------
if (score_1 + score_2) < 500:
background = bg_1
elif (score_1 + score_2) < 1500:
background = bg_2
else:
background = bg_3