Exemple #1
0
  def __init__(self):
    self.level = level.random_ground(puit.gamemaster.scrollarea.width, puit.gamemaster.scrollarea.height)
    super(Menu, self).__init__()
    self.add_object(self.level)

    self.left_spawn = CPUPlayerSpawnarea(Team(),[0, 50], 20, 1, (5, 20))
    self.add_object(self.left_spawn)
    self.right_spawn = CPUPlayerSpawnarea(Team({(0,0,0):(255,255,255), (255,255,255):(0,0,0), (128,128,128):(200, 23, 41)}),[self.level.width()-20, 50], 20, 1, (5, 20))
    self.add_object(self.right_spawn)
    
    self.add_object(MenuStuff(74, 81))
Exemple #2
0
class Menu(Gamestate):
  def __init__(self):
    self.level = level.random_ground(puit.gamemaster.scrollarea.width, puit.gamemaster.scrollarea.height)
    super(Menu, self).__init__()
    self.add_object(self.level)

    self.left_spawn = CPUPlayerSpawnarea(Team(),[0, 50], 20, 1, (5, 20))
    self.add_object(self.left_spawn)
    self.right_spawn = CPUPlayerSpawnarea(Team({(0,0,0):(255,255,255), (255,255,255):(0,0,0), (128,128,128):(200, 23, 41)}),[self.level.width()-20, 50], 20, 1, (5, 20))
    self.add_object(self.right_spawn)
    
    self.add_object(MenuStuff(74, 81))

  def on_key_press(self, symbol, modifiers):
    super(Menu, self).on_key_press(symbol, modifiers)
  
  def tick(self):
    super(Menu, self).tick()
    
    if len(self.objects) < 5:
      self.left_spawn.resume()
      self.left_spawn.frame_interval = (10, 30)
      self.right_spawn.resume()
      self.right_spawn.frame_interval = (10, 30)
    elif len(self.objects) > 15:
      self.left_spawn.frame_interval = (50, 500)
      self.right_spawn.frame_interval = (50, 500)
    elif len(self.objects) > 30:
      self.left_spawn.pause()
      self.right_spawn.pause()
      

  def draw(self):
    super(Menu, self).draw()
    self.mainloop.scroll_to((0,0))
    
    x = 150
    y = 81
    puit.gamemaster.pixelfont.draw('highscore', x, y)
    puit.gamemaster.pixelfont.draw(str(puit.gamemaster.highscore.get_score()), x, y-7)
    
    graphics.get_image(os.path.join('data', 'logo.png')).blit(5, 50)