Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuiz Irber <luiz.irber@gmail.com>2008-04-12 01:13:55 (GMT)
committer Luiz Irber <luiz.irber@gmail.com>2008-04-12 01:13:55 (GMT)
commit29fda6940b651e80f6e34534ba034f0940c21057 (patch)
treef69d45d38688517947cd977bf534b532d2858108
parent335ff12ebdfb53392813c91e9e98c9076e32dba5 (diff)
Removed the is_static in levels.py and used the mobility attr from objects.
-rw-r--r--Gambiarra/levels.py19
1 files changed, 6 insertions, 13 deletions
diff --git a/Gambiarra/levels.py b/Gambiarra/levels.py
index 6a813c9..41051d5 100644
--- a/Gambiarra/levels.py
+++ b/Gambiarra/levels.py
@@ -30,13 +30,6 @@ from objects import *
from command import *
-def _is_static(obj):
- # FIXME: we need to define a way of saying that an object is static, this
- # "if" is repulsive! =D
- if (isinstance(obj, Target) or isinstance(obj, Esteira)
- or isinstance(obj, Elastica)):
- return True
-
class SimulationView(object):
""" This widget holds the objects being simulated. """
running = None
@@ -51,10 +44,10 @@ class SimulationView(object):
self.staticObjs = []
for obj in objects.values():
- if _is_static(obj):
- self.staticObjs.append(obj)
- else:
+ if obj.mobility:
obj.add(self.objects)
+ else:
+ self.staticObjs.append(obj)
self.staticObjs.append(LeftWall())
self.staticObjs.append(RightWall())
@@ -75,10 +68,10 @@ class SimulationView(object):
item.draw(screen, item.rect.topleft)
def add(self, obj):
- if _is_static(obj):
- self.staticObjs.append(obj)
- else:
+ if obj.mobility:
obj.add(self.objects)
+ else:
+ self.staticObjs.append(obj)
class ObjectBar(object):
""" This widget contains the objects available for the problem. """