Exemple #1
0
 def generate_obstacle(self):
     self.obstacle_width = 0.3 * Constants.screen_width
     self.obstacle_height = 0.06 * Constants.screen_height
     rect = Rectangle(Vector2(0.5 * Constants.screen_width - 0.5 * self.obstacle_width, - 3*self.obstacle_height),
                      Vector2(self.obstacle_width, self.obstacle_height),
                      Material((255, 255, 255)))
     rect.animation = ObstaclePulsingAnimation(rect)
     rect.animator = Animator(rect, [rect.animation])
     rect.animator.play()
     rect.visible = True
     self.game_object_list.append(rect)
Exemple #2
0
 def generate_obstacle(self):
     direction = rand(0, 1) < 0.5
     rect = Rectangle(
         Vector2(direction * 0.5 * Constants.screen_width + 12,
                 -0.06 * Constants.screen_height),
         Vector2(0.45 * Constants.screen_width,
                 0.06 * Constants.screen_height), Material((255, 255, 255)))
     rect.animation = ObstaclePulsingAnimation(rect)
     rect.animator = Animator(rect, [rect.animation])
     rect.animator.play()
     rect.visible = True
     self.game_object_list.append(rect)