File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 45
45
from cocosnode import CocosNode
46
46
from euclid import Point2
47
47
48
+ class ExceptionNoEmptyParticle (Exception ):
49
+ """particle system have no room for another particle"""
50
+ pass
51
+
48
52
rand = lambda : random .random () * 2 - 1
49
53
50
54
# PointerToNumpy by Gary Herron
@@ -267,7 +271,7 @@ def add_particle( self ):
267
271
Code calling add_particle must be either:
268
272
be sure there is room for the particle
269
273
or
270
- be prepared to catch the exception Exception("No empty particle")
274
+ be prepared to catch the exception ExceptionNoEmptyParticle
271
275
It is acceptable to try: ... except...: pass
272
276
"""
273
277
self .init_particle ()
@@ -336,7 +340,7 @@ def init_particle( self ):
336
340
if len (idxs [0 ]) > 0 :
337
341
idx = idxs [0 ][0 ]
338
342
else :
339
- raise Exception ( "No empty particle" )
343
+ raise ExceptionNoEmptyParticle ( )
340
344
341
345
# position
342
346
self .particle_pos [idx ][0 ] = self .pos_var .x * rand ()
You can’t perform that action at this time.
0 commit comments