[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] main game object using singleton/global/static?



Is there a shortcut or easier way than what I am doing? Because having to use the same reference in every object seems redundant?

I am using a 

I feel I am spamming "self." A lot of my classes have a lot of "self." lines Example of random code:

class Unit():
def onCollide(self, other):
if self.modifiedHP() - other.damage() < 0:
self.die()
self.game.playsound("boom")
self.game.spawn("item")

So I'm looking for advice on if this is normal? Or bad code?
--
Jake