Revision: 289
http://virtplayground.svn.sourceforge.net/virtplayground/?rev=289&view=rev
Author: BlueWolf_
Date: 2009-03-23 21:50:06 +0000 (Mon, 23 Mar 2009)
Log Message:
-----------
Rects should not be saved
Modified Paths:
--------------
branches/VP-Grounds/modules/playground.py
Modified: branches/VP-Grounds/modules/playground.py
===================================================================
--- branches/VP-Grounds/modules/playground.py 2009-03-23 15:00:53 UTC (rev 288)
+++ branches/VP-Grounds/modules/playground.py 2009-03-23 21:50:06 UTC (rev 289)
@@ -15,9 +15,6 @@
#Objects will have all the object-classes.
#the key is the name of the object.
self.objects = {}
- #rects is an dict where the keys are the rects
- #and the values are the names of the object.
- self.rects = {}
self.walkingDir = [False] * 4 #up, left, right, down
@@ -120,8 +117,6 @@
self.loadGround(msg['data'])
elif arg[0] == 'UserUpdate':
- updateRects = [] #What's this??
-
user = arg[1]
#Is this on our ground? Do we need to update it?
if user.has_key('Pos') and user['Pos'] != None:
@@ -172,12 +167,19 @@
"""
if self.dontUpdate == False:
self.lock.acquire()
- self.createRects()
- collidelist = rect.collidedictall(self.rects)
+ #Create our rect-dict
+ rects = {}
+ for name, obj in self.objects.items():
+ rects[tuple(obj.rect)] = name
+ #Get the name of which rects collides
+ collidelist = rect.collidedictall(rects)
+
+ #Sort it with zorder
collidelist = self.sortObjectList(collidelist)
+ #Update the one which collide
for name in collidelist:
obj = self.objects[name]
obj.update(self.surf, rect)
@@ -199,9 +201,6 @@
#What is this?
if info['object'] == 'object':
self.openObject('object', name, info)
-
-
- self.createRects()
def openObject(self, objname, name, data):
"""
@@ -217,13 +216,6 @@
obj = self.modObjects[objname]
obj = obj(data, self.sh)
self.objects[name] = obj
-
-
- def createRects(self):
- #Generate self.rects
- self.rects = {}
- for name, obj in self.objects.items():
- self.rects[tuple(obj.rect)] = name
def sortObjectList(self, objectList):
#Get the list of all zorders and names
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|