atyachari / Flippy

A game in which a player has to invert the tiles of the opponent.
MIT License
0 stars 10 forks source link

Increase code modularity #12

Open atyachari opened 1 year ago

atyachari commented 1 year ago

Move different entities in different files

jotasprout commented 1 year ago

Please assign this to me. Thank you.

jotasprout commented 1 year ago

Thank you! I am on the case! Will get to it after work this afternoon.

jotasprout commented 1 year ago

Sorry, first day of new job was super long and I haven't started yet but am still committed.

jotasprout commented 1 year ago

Are you okay with just splitting this up into different files -- maybe by related functionality and importing them into the main "game" file?

atyachari commented 1 year ago

Yes @jotasprout , you can split it into multiple files. Also, in your last commit the changes in game.py were not present. Please fix that as well.

jotasprout commented 1 year ago

Do you mean the changes to lines 21 and 25 (now lines 23 and 27)? When I update my local to yours, they show up.

jotasprout commented 1 year ago

Before I start chopping things up (and testing each chop), I want to make sure I start with a working copy. When I follow the instructions in the README, I get the following:


Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "/Users/jaysprout/Documents/GitHub/hacktoberfest/Flippy/game.py", line 445, in <module>
    main()
  File "/Users/jaysprout/Documents/GitHub/hacktoberfest/Flippy/game.py", line 17, in main
    DISPLAYSURF = pygame.display.set_mode((config.getint('int_var',window_width), config.getint('int_var',window_height)))
  File "/usr/local/Cellar/python@3.9/3.9.13_2/Frameworks/Python.framework/Versions/3.9/lib/python3.9/configparser.py", line 818, in getint
    return self._get_conv(section, option, int, raw=raw, vars=vars,
  File "/usr/local/Cellar/python@3.9/3.9.13_2/Frameworks/Python.framework/Versions/3.9/lib/python3.9/configparser.py", line 808, in _get_conv
    return self._get(section, conv, option, raw=raw, vars=vars,
  File "/usr/local/Cellar/python@3.9/3.9.13_2/Frameworks/Python.framework/Versions/3.9/lib/python3.9/configparser.py", line 803, in _get
    return conv(self.get(section, option, **kwargs))
  File "/usr/local/Cellar/python@3.9/3.9.13_2/Frameworks/Python.framework/Versions/3.9/lib/python3.9/configparser.py", line 781, in get
    d = self._unify_values(section, vars)
  File "/usr/local/Cellar/python@3.9/3.9.13_2/Frameworks/Python.framework/Versions/3.9/lib/python3.9/configparser.py", line 1152, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'int_var'```
atyachari commented 1 year ago

You are facing the issue because in this PR the config is not set correctly. It should be referenced from resources directory. You might need to update here.