Ignore:
Timestamp:
09/05/13 11:09:14 (8 years ago)
Author:
Neil Muller <drnlmuller@…>
Branch:
default
Phase:
public
Message:

Move protagonist to the world

Location:
nagslang/screens
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • nagslang/screens/area.py

    r272 r276  
    88from nagslang.events import ScreenChange, DoorEvent, FireEvent
    99from nagslang.level import Level
    10 from nagslang.protagonist import Protagonist
    1110from nagslang.screens.base import Screen
    1211from nagslang.game_object import Bullet
     
    7473        self.add_walls()
    7574        self._add_collision_handlers()
    76         if self.protagonist is not None:
    77             # We do things this way to avoid extra pymunk
    78             # juggling to move objects between spaces
    79             old_protagonist = self.protagonist
    80             self.add_protagonist()
    81             self.protagonist.copy_state(old_protagonist)
    82         else:
    83             self.add_protagonist()
     75        self.add_protagonist()
    8476        self.add_game_objects()
    8577        sound.play_music("POL-cyber-factory-short.ogg")
     
    124116
    125117    def add_protagonist(self):
    126         self.protagonist = Protagonist(self.space, (350, 300))
     118        self.protagonist = self.world.protagonist
     119        self.protagonist.change_space(self.space)
    127120        self._drawables.add(self.protagonist)
    128121
     
    143136                self._disable_render = True
    144137                self.world.rooms += 1
    145                 ScreenChange.post(ev.destination, self.protagonist)
     138                ScreenChange.post(ev.destination)
    146139                return
    147140            # else we're teleporting within the screen, and just the
  • nagslang/screens/base.py

    r180 r276  
    77class Screen(object):
    88
    9     def __init__(self, name, player, world):
     9    def __init__(self, name, world):
    1010        self.name = name
    1111        self.world = world
    12         self.protagonist = player
    1312        self.space = pymunk.Space()
    1413
  • nagslang/screens/menu.py

    r252 r276  
    4747
    4848    def play(self):
    49         ScreenChange.post('level1', None)
     49        ScreenChange.post('level1')
    5050
    5151    def restart(self):
Note: See TracChangeset for help on using the changeset viewer.