Пример #1
0
 def add_buttons(self, arr, starting_index, finishing_index):
     g = self.generate_buttons(arr, starting_index, finishing_index)
     i = next(g)
     while i:
         self.buttons.append(i)
         World.add(i)
         i = next(g)
Пример #2
0
 def spawn(coordinates, main_character=None):
     if main_character is None:
         main_character = Settings.main_character_name
     mc = eval('%s()' % main_character)
     mc.coordinates = coordinates
     World.promote_main(mc)
     World.add(mc)
Пример #3
0
 def update_confined(self):
     World.remove(self.mouse_confined_button)
     if Settings.mouse_confined:
         self.mouse_confined_button.texts[0].set_text('Mouse confined')
     else:
         self.mouse_confined_button.texts[0].set_text('Mouse unconfined')
     World.add(self.mouse_confined_button)
Пример #4
0
 def load(self):
     for obj in self.world:
         World.add(obj)
         if 'spawn' in obj.type:
             self.spawn = obj
         if 'target' in obj.type:
             self.targets.append(obj)
     GameStates.spawn(self.spawn.get_coordinates())
Пример #5
0
 def add_characters(self, arr, starting_index, finishing_index):
     g = self.generate_characters(arr, starting_index, finishing_index)
     i = next(g)
     while i[0]:
         self.characters.append(i[0])
         World.add(i[0])
         self.buttons.append(i[1])
         World.add(i[1])
         i = next(g)
Пример #6
0
 def create_gravity_field(self):
     if World.main_character is not None:
         if KeyLogger.bindings['gravity'].check():
             gf = NormalGravityField()
             gf.coordinates = Mouse.get_real_coordinates() - Coordinates(
                 gf.width / 2, gf.height / 2)
             gf.type.append('unmovable')
             World.add(gf)
             return True
     return False
Пример #7
0
 def click_play(self):
     self.end()
     self.empty()
     bck = Background('resources\\test_images\\white_background.png')
     World.add(bck)
     level = Level(self.gamestates, self.path.split('\\')[-1][:-4])
     World.setup_level(level)
     World.add(self.gamestates.target_label)
     thread_lock.pause_main = False
     self.gamestates.state = self.gamestates.GAME
     Frame.default_coordinates = Coordinates(0, 0)
     if Borders.focus_object is None:
         Borders.gain_focus(World.main_character)
     Borders.lock()
     pygame.event.set_grab(Settings.mouse_confined)
     self.gamestates.sleep()
Пример #8
0
 def click_build(self):
     self.empty()
     bck = Background('resources\\test_images\\white_background.png')
     World.add(bck)
     save_button = SaveButton()
     save_button.coordinates = Coordinates(650, 500)
     World.add(save_button)
     level = Level(self.gamestates, '')
     World.setup_level(level)
     thread_lock.pause_main = False
     self.gamestates.state = self.gamestates.BUILDER
     Frame.default_coordinates = Coordinates(0, 0)
     if Borders.focus_object is None:
         Borders.gain_focus(World.main_character)
     Borders.lock()
     pygame.event.set_grab(Settings.mouse_confined)
     self.gamestates.sleep()
Пример #9
0
 def display_name(self):
     name = Settings.main_character_name
     lname = LevelName('Character selected:   ' + name, 30,
                       Coordinates(200, 50))
     self.name_label = lname
     World.add(lname)
Пример #10
0
 def load(self):
     for obj in self.world:
         World.add(obj)
Пример #11
0
 def fire_normal_bullet(self, direction):
     bullet = NormalBullet(direction)
     bullet.coordinates = self.get_firing_coordinates()
     World.add(bullet)
Пример #12
0
 def display_name(self):
     name = self.path.split('\\')[-1][:-4]
     lname = LevelName(name, 50, Coordinates(100, 100))
     self.name_label = lname
     World.add(lname)