Exemplo n.º 1
0
 def updateActorList(self):
     """Update the list of actors"""
     try:
         world = self.engine.getCurrentWorld()
     except serge.engine.NoCurrentWorld:
         return
     self.view_actors.model.clear()
     for actor in world.getActors():
         self.addActorToList(actor)
Exemplo n.º 2
0
 def updateActorList(self):
     """Update the list of actors"""
     try:
         world = self.engine.getCurrentWorld()
     except serge.engine.NoCurrentWorld:
         return
     self.view_actors.model.clear()
     for actor in world.getActors():
         self.addActorToList(actor)
Exemplo n.º 3
0
 def updateActor(self, interval, world):
     """Update the actor"""
     #
     self.growth += float(interval)/self.rate
     if self.growth >= len(self.colours):
         # We have died
         self.log.info('Removing dead guy at %d, %d. Left is %d' % (self.x, self.y, len(world.getActors())-1))
         world.removeActor(self)
         return
     #
     self.visual.growth = self.growth
     self.visual.size = self.width
     self.visual.x = self.x
     self.visual.y = self.y
     #
     #if random.random() < self.grow_prob:
     #    self.resizeTo(self.width+1, self.height+1)
     if random.random() < self.spawn_prob*interval:
         new_x = self.x + random.randint(-self.spawn_dist, self.spawn_dist)
         new_y = self.y + random.randint(-self.spawn_dist, self.spawn_dist)
         new = self.__class__(self.colours, self.rate, self.grow_prob, self.spawn_prob, self.spawn_dist, self.blue)
         new.setSpatial(new_x, new_y, random.randint(1, 5), 20)
         new.setLayerName('base')
         world.addActor(new)