Changeset 179:1ee8756888e4


Ignore:
Timestamp:
Sep 3, 2013, 2:57:09 PM (7 years ago)
Author:
Neil Muller <drnlmuller@…>
Branch:
default
rebase_source:
1367b34dff55a741ec2bd589452a73e029ed6c85
Message:

Add some state manipulation helper methods

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/protagonist.py

    r156 r179  
    188188        self.renderer.start()
    189189
     190    def set_position(self, position):
     191        self._body.position = position
     192
     193    def copy_state(self, old_protagonist):
     194        self._physicsers[self.form].remove_from_space()
     195        self._body.position = old_protagonist._body.position
     196        self.form = old_protagonist.form
     197        self.angle = old_protagonist.angle
     198        self.render_form = old_protagonist.render_form
     199        self.inventory = old_protagonist.inventory
     200        self.renderer = self._renderers[self.render_form]
     201        self._physicsers[self.form].add_to_space()
     202
    190203    def toggle_form(self):
    191204        if self.form == self.WOLF_FORM:
Note: See TracChangeset for help on using the changeset viewer.