Mercurial > skaapsteker
changeset 23:5c9f2eeeb629
Very start of world / physics engine.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Sun, 03 Apr 2011 18:02:41 +0200 |
parents | b815471d4b95 |
children | 3d70de522b11 |
files | skaapsteker/physics.py |
diffstat | 1 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/skaapsteker/physics.py Sun Apr 03 17:55:07 2011 +0200 +++ b/skaapsteker/physics.py Sun Apr 03 18:02:41 2011 +0200 @@ -13,4 +13,15 @@ class World(object): - pass + + def __init__(self): + self._all = pygame.sprite.Group() + self._mobiles = pygame.sprite.Group() + self._gravitators = pygame.sprite.Group() + + def add(self, sprite): + self._all.add(sprite) + if sprite.mobile: + self._mobiles.add(sprite) + if sprite.gravitates: + self._gravitators.add(sprite)