示例#1
0
 def run_bullet(self, dt):
     x, y = self.position
     if y > config.WINDOS_HEIGHT + self.height:
         self.unschedule(self.run_bullet)
         feiji_event.dispatch_event('on_bullet_resuable', self)
     y += 10
     self.position = x, y
     self.cshape.center = collision.eu.Vector2(x, y)
示例#2
0
 def run_enemy(self, dt):
     x, y = self.position
     y -= 10
     self.position = x, y
     self.cshape.center = collision.eu.Vector2(x, y)
     if y <= -self.height:
         self.unschedule(self.run_enemy)
         feiji_event.dispatch_event('on_enemy_resuable', self)
示例#3
0
 def _game_over(self, dt):
     self.kill()
     # self.unschedule(self.update_position)
     self.unschedule(self._game_over)
     #分发事件
     feiji_event.dispatch_event('on_game_over')
示例#4
0
 def explode(self):
     self.position = 0, -100
     self.unschedule(self.run_bullet)
     self.cshape.center = collision.eu.Vector2(*self.position)
     feiji_event.dispatch_event('on_bullet_resuable', self)
示例#5
0
 def _prepare_to_use(self, dt):
     self.position = 0, -100
     self.cshape.center = collision.eu.Vector2(*self.position)
     feiji_event.dispatch_event('on_enemy_resuable', self)
     self.image = pyglet.resource.image('img/enemy/enemy_small1.png')
     self.unschedule(self._prepare_to_use)
示例#6
0
 def pause_game(self):
     feiji_event.dispatch_event("on_game_resume")
示例#7
0
 def parse_game(self):
     feiji_event.dispatch_event("on_game_pause")
示例#8
0
 def rest_game(self):
     feiji_event.dispatch_event('on_game_start')