Game Objects Library

Hi all,
In my quest to break my mindspace project into small chunks, I have just released the objects part of the code.

dumpible_objects provides you with an easy systems-agnostic way to represent your game objects pythonically, while making it dead easy to dump and load them to and from a simple json file.

To read the full docs (I don't want to repeat myself here), read the docs (and clone or whatever):
https://github.com/chrisnorman7/dumpible_objects

Here's a basic object though:

from dumpible_objects import BaseObject
class Weapon(BaseObject):
    def post_init(self):
        self.add_attribute('name', default='ordinalry-looking gun')  # The name of the weapon.
        self.add_attribute('shots', default=5)  # The number of shots left (or maybe blade strength?).
        self.add_attribute('#target')  # Preserves the target, assuming it is another instance of BaseObject.

That object would dump and reload with no problems, so you see you don't have to write boilerplate code for dumping the object, use multiple files or anything like that.

Hope this helps someone. There's a full test suite (11 tests), and the code is written specifically for Python 3.5, although it might work on earlier versions.

_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector

Reply via email to