Exemplo n.º 1
0
 def reset_path(self):
     AccelerationPath.reset(self)
     ''' set position for alien ship out of the screen '''
     self.set_position((-90, -90))
     ''' set no velocity and acceleration '''
     self.set_acceleration(0, 0)
     self.set_velocity(0, 0)
     self.is_hidden = True
     self.hide_time, self.show_time = 0, 0
     self.hide_object_time = random.randrange(5, 25) * 1000
     self.show_object_time = random.randrange(1, 10) * 1000
     self.visible_on_screen, self.approach_object = False, False
Exemplo n.º 2
0
 def next(self):
     ticks = conf.ticks
     if not self.is_hidden:
         self.show_time += ticks
         if self.show_time > self.show_object_time:
             self.approach()
     else:
         self.hide_time += ticks
         if self.hide_time > self.hide_object_time:
             self.set_random_path()
             self.is_hidden = False
             self.visible_on_screen = True
             
     if self.approach_object and self.visible_on_screen:
         if not self.is_on_screen(180):
             self.reset_path()
     return AccelerationPath.next(self, ticks)
Exemplo n.º 3
0
 def __init__(self):
     AccelerationPath.__init__(self)
     self.reset_path()