![]() |
Display Globar Variable - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Display Globar Variable (/thread-16907.html) |
Display Globar Variable - N0m1t - Mar-19-2019 I'm building a simple racing game and I want to display a count of wall hits. I print count in the console and everything is OK (the number is changing) but doesn't change when I print on the screen. https://github.com/Nomit83/RaceGame If someone can look into my code and tell me what I'm doing wrong. RE: Display Globar Variable - metulburr - Mar-19-2019 you should make sure to use consistent names as linux is case sensitive I would use the player class to have an attribute count that retains the number of wall hits that players has done. This would be better suited for a couple of reasons. 1) you plan on having more than one player and 2) its not static data and will be changing mid game. Your settings file would be better suited as static data that does not change mid game. Your game class is well organized. However your player one file is not. It has the wall and collision global function in it. Your also using global in a class which is kind of weird. Why did you decided to the collision should be out of the player class? |