diff options
author | Gary Martin <gary@garycmartin.com> | 2009-06-16 01:47:48 (GMT) |
---|---|---|
committer | Gary Martin <gary@garycmartin.com> | 2009-06-16 01:47:48 (GMT) |
commit | 2b229a1aadb38d822da8b2f62461c0a624dfd6bc (patch) | |
tree | 66ca4de647d59068c28999b4558bdaa0b922acd6 /tools.py | |
parent | 658da0e846d2dbf244c320ce3a67fa4656490f83 (diff) |
Default behaviour of poly tool a solid rather than decomposed triangles (much more useful), old behaviour still there via 2nd mouse button.
Diffstat (limited to 'tools.py')
-rw-r--r-- | tools.py | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -172,19 +172,23 @@ class PolygonTool(Tool): if not self.vertices: self.vertices=[event.pos] elif distance(event.pos,self.vertices[0]) < 15: + self.vertices.append(self.vertices[0]) #connect the polygon + self.game.world.add.complexPoly(self.vertices, dynamic=True, density=1.0, restitution=0.16, friction=0.5) + self.vertices = None + else: + self.vertices.append(event.pos) + + elif event.button == 3: + if not self.vertices: + self.vertices=[event.pos] + elif distance(event.pos,self.vertices[0]) < 15: #self.vertices.append(self.vertices[0]) #connect the polygon gons = decomposePoly(self.vertices) for g in gons: self.game.world.add.convexPoly(g, dynamic=True, density=1.0, restitution=0.16, friction=0.5) - #self.game.world.add.complexPoly(self.vertices, dynamic=True, density=1.0, restitution=0.16, friction=0.5) - self.vertices = None + self.vertices = None else: self.vertices.append(event.pos) - if event.button == 3: - if self.vertices: - self.vertices.append(event.pos) - self.game.world.add.complexPoly(self.vertices, dynamic=True, density=1.0, restitution=0.16, friction=0.5) - self.vertices = None def draw(self): # draw the poly being created |