Ignore:
Timestamp:
Sep 6, 2013, 9:58:15 PM (7 years ago)
Author:
Stefano Rivera <stefano@…>
Branch:
default
rebase_source:
5077a64a868295383cfa281f1f69c605a3d6437c
Message:

Use a result object to get new drawables back to the area

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/collectable.py

    r378 r385  
    44from nagslang import render
    55from nagslang.constants import ZORDER_LOW
    6 from nagslang.game_object import GameObject, SingleShapePhysicser, make_body
     6from nagslang.game_object import (GameObject, SingleShapePhysicser, Result,
     7                                  make_body)
    78from nagslang.resources import resources
    89
     
    1314    def __init__(self, space, name, shape, renderer):
    1415        self._name = name
     16        self.collected = False
    1517        shape.sensor = True
    1618        super(CollectibleGameObject, self).__init__(
     
    2426    def _collect(self, protagonist):
    2527        protagonist.add_item(self._name)
    26         # TODO: Make this less hacky.
    2728        self.physicser.remove_from_space()
    28         self.renderer = render.NullRenderer()
     29        self.collected = True
     30
     31    def update(self, dt):
     32        if self.collected:
     33            return Result(remove=[self])
    2934
    3035
Note: See TracChangeset for help on using the changeset viewer.