Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/area_editor.py

    r239 r236  
    3434from nagslang.enemies import Enemy, get_editable_enemies
    3535from nagslang.game_object import get_editable_game_objects
    36 from nagslang.puzzle import get_editable_puzzlers, PuzzleGlue
     36from nagslang.puzzle import get_editable_puzzlers
    3737
    3838# layout constants
     
    172172        return self._surface.copy()
    173173
    174     def reset_objs(self):
    175         # Reset the object state - needed when changing stuff
    176         self.drawables = []
    177         self.overlay_drawables = []
    178         self._glue = PuzzleGlue()
    179         for game_object_dict in self._game_objects:
    180             self._create_game_object(pymunk.Space(), **game_object_dict)
    181         for enemy_dict in self._enemies:
    182             self._create_enemy(pymunk.Space(), **enemy_dict)
    183 
    184174
    185175class ObjectTable(TableView):
     
    402392            pass
    403393        elif res == 'Delete':
    404             self.level._game_objects.remove(choice)
    405             self.level.reset_objs()
     394            pass
    406395
    407396    def edit_enemies(self):
     
    415404            pass
    416405        elif res == 'Delete':
    417             self.level._enemies.remove(choice)
    418             self.level.reset_objs()
     406            pass
    419407
    420408    def _make_choice_dialog(self, classes):
     
    423411        for cls_name, cls in classes:
    424412            data.append({"classname": cls_name, "class": cls})
    425         choice_box = Dialog()
    426         choice_box.rect = pygame.rect.Rect(0, 0, 700, 500)
     413        edit_box = Dialog()
     414        edit_box.rect = pygame.rect.Rect(0, 0, 700, 500)
    427415        table = ObjectTable(data)
    428         choice_box.add(table)
     416        edit_box.add(table)
    429417        buttons = []
    430418        for text in ['OK', 'Cancel']:
    431             but = Button(text, action=lambda x=text: choice_box.dismiss(x))
     419            but = Button(text, action=lambda x=text: edit_box.dismiss(x))
    432420            buttons.append(but)
    433421        row = Row(buttons)
    434422        row.rect = pygame.rect.Rect(0, 450, 700, 50)
    435         choice_box.add(row)
    436         choice_box.get_selection = lambda: table.get_selection()
    437         return choice_box
     423        edit_box.add(row)
     424        edit_box.get_selection = lambda: table.get_selection()
     425        return edit_box
    438426
    439427    def add_game_object(self):
Note: See TracChangeset for help on using the changeset viewer.