Changeset 335:c6552e9fc2e1


Ignore:
Timestamp:
04/09/11 10:15:19 (12 years ago)
Author:
Jeremy Thurgood <firxen@…>
Branch:
default
Phase:
public
Message:

Added aburage.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • data/game.json

    r319 r335  
    3030        "teacupfull": { "type": "TeaCupFull", "level": "_limbo", "pos": [0, 0] },
    3131        "vase": { "type": "Vase", "level": "geisha_room", "pos": [1, 3], "broken": false },
    32         "salmon": { "type": "Salmon", "level": "fishmonger_house", "pos": [1, 3] }
     32        "salmon": { "type": "Salmon", "level": "fishmonger_house", "pos": [1, 3] },
     33        "aburage_001": { "type": "Aburage", "level": "temple", "pos": [12, 2] },
     34        "aburage_002": { "type": "Aburage", "level": "temple", "pos": [14, 2] }
    3335    },
    3436    "npcs": {
  • skaapsteker/sprites/base.py

    r333 r335  
    226226    mobile = False
    227227    gravitates = False
     228    actionable = True
    228229
    229230    collision_layer = NPC_LAYER
    230231
    231     portable = True
    232     actionable = True
     232    debug_color = (240, 0, 240)
    233233
    234234    def __init__(self, pos, **opts):
     
    240240        self.name = name
    241241        self.world = world
    242         self.item_state = getattr(self.world.items, self.name)
    243 
    244 
    245     def get_debug_color(self):
    246         if self.portable:
    247             return (240, 0, 240)
    248         return (0, 0, 240)
     242        self._me = getattr(self.world.items, self.name)
    249243
    250244
     
    253247        player.take_item(self)
    254248
     249
     250    def remove(self):
     251        self._me.level = '_limbo'
     252        self.kill()
    255253
    256254
  • skaapsteker/sprites/items.py

    r297 r335  
    11from base import Item
    22
     3
     4##################################################
     5# Collectibles
     6
     7class Aburage(Item):
     8    image_file = 'tofu.png'
     9
     10    def player_action(self, player):
     11        player.eat_aburage()
     12        self.remove()
     13
     14
     15
     16##################################################
     17# Monk tea mission
    318
    419class TeaCup(Item):
     
    1631class TeaPot(Item):
    1732    image_file = 'teapot.png'
    18     portable = False
    1933
    2034    def setup(self, brewed, **opts):
     
    2438    def player_action(self, player):
    2539        if player.has_item('tealeaf'):
    26             self.item_state.brewed = True
     40            self._me.brewed = True
    2741            player.discard_item()
    2842            return
    2943        if player.has_item('teacup'):
    30             if self.item_state.brewed:
     44            if self._me.brewed:
    3145                player.discard_item()
    3246                player.take_item_by_name('teacupfull')
    33                 self.item_state.brewed = False
     47                self._me.brewed = False
    3448            else:
    3549                print "Sadly, the teapot is empty."
     50
     51
     52##################################################
     53# Unclassified
    3654
    3755
     
    4765class Salmon(Item):
    4866    image_file = 'dummy.png'
     67
     68
     69
  • skaapsteker/sprites/player.py

    r332 r335  
    4040        # We muck with these in load for convience, so ensure they're right
    4141        self.the_world = the_world
     42        self._me = the_world.fox
    4243        self.set_facing('left')
    4344        self.set_image()
     
    4849
    4950    def set_image(self):
    50         key = self._make_key(len(self.the_world.fox.tails))
     51        key = self._make_key(len(self._me.tails))
    5152        images = self._image_dict[key]
    5253        if self._animation_frame >= len(images):
     
    168169        if hasattr(other, 'collided_player'):
    169170            other.collided_player(self)
    170             print 'Health', self.the_world.fox.cur_health
     171            print 'Health', self._me.cur_health
    171172
    172173
    173174    def damage(self, damage):
    174         self.the_world.fox.cur_health -= damage
     175        self._me.cur_health -= damage
    175176        self._soundsystem.play_sound('yelp')
    176         if self.the_world.fox.cur_health <= 0:
     177        if self._me.cur_health <= 0:
    177178            PlayerDied.post()
    178179
    179180    def restore(self):
    180181        """Restore player to max health (for restarting levels, etc.)"""
    181         self.the_world.fox.cur_health = self.the_world.fox.max_health
     182        self._me.cur_health = self._me.max_health
    182183
    183184    def set_pos(self, pos):
     
    231232        if self._touching_actionables:
    232233            self._touching_actionables[0].player_action(self)
    233         elif self.the_world.fox.item is not None:
     234        elif self._me.item is not None:
    234235            self.drop_item()
    235236
     
    237238    def action_fire1(self):
    238239        # FIXME: Use the correct tail properties for this
    239         if len(self.the_world.fox.tails) < 2:
     240        if len(self._me.tails) < 2:
    240241            # Only have a bite attack
    241242            print 'attacking'
     
    299300
    300301    def discard_item(self):
    301         self.the_world.fox.item = None
     302        self._me.item = None
    302303
    303304
    304305    def get_sprite(self, set_level):
    305         my_item = self.the_world.fox.item
     306        my_item = self._me.item
    306307        if my_item is None:
    307308            return None
    308309        world_item = getattr(self.the_world.items, my_item)
    309310        if set_level:
    310             world_item.level = self.the_world.fox.level
     311            world_item.level = self._me.level
    311312            world_item.pos = [a/b for a, b in zip(self.rect.center, TILE_SIZE)]
    312313        sprite_dict = world_item.copy()
     
    328329        self.take_item_by_name(item.name)
    329330        # We create a scaled version of the image for the inventory display
    330         item.kill()
     331        item.remove()
    331332        print "took", item
    332333
     
    350351        self.drop_item()
    351352        getattr(self.the_world.items, item_name).level = "_limbo"
    352         self.the_world.fox.item = item_name
     353        self._me.item = item_name
    353354        self.make_inventory_image()
    354355
    355356
    356357    def has_item(self, item):
    357         return self.the_world.fox.item == item
     358        return self._me.item == item
    358359
    359360
    360361    def add_actionable(self, actionable):
    361362        self._touching_actionables.append(actionable)
     363
     364
     365    def eat_aburage(self):
     366        self._me.tofu += 1
     367
Note: See TracChangeset for help on using the changeset viewer.