Changeset 475:18427edff33a


Ignore:
Timestamp:
04/09/11 19:53:19 (12 years ago)
Author:
Neil Muller <drnlmuller@…>
Branch:
default
Phase:
public
Message:

Add facing support to npcs

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • data/game.json

    r472 r475  
    157157    },
    158158    "npcs": {
    159         "monk": { "type": "Monk", "level": "temple", "pos": [15, 16], "dsm": "npcs/monk.json", "state": "start" },
    160         "guard": { "type": "Guard", "level": "temple_grounds", "pos": [5, 11], "dsm": "npcs/guard.json", "state": "start", "block": true },
    161         "hattori": { "type": "Hattori", "level": "road", "pos": [37, 8], "dsm": "npcs/hattori.json", "state": "start", "block": true },
    162         "ichiro": { "type": "Ichiro", "level": "road", "pos": [36, 8], "dsm": "npcs/ichiro.json", "state": "start", "block": true },
    163         "sasuke": { "type": "Sasuke", "level": "road", "pos": [56, 8], "dsm": "npcs/sasuke.json", "state": "start", "block": true },
    164         "kaneda2": { "type": "Kaneda", "level": "tea_house", "pos": [6, 10], "dsm": "npcs/kaneda2.json", "state": "start" },
    165         "tetsuo": { "type": "Tetsuo", "level": "tea_house", "pos": [9, 10], "dsm": "npcs/tetsuo.json", "state": "start" },
    166         "kaneda": { "type": "Kaneda", "level": "geisha_house", "pos": [10, 3], "dsm": "npcs/kaneda.json", "state": "start" },
    167         "kumiko": { "type": "Kumiko", "level": "geisha_room", "pos": [11, 13], "dsm": "npcs/kumiko.json", "state": "start" },
    168         "maneki": { "type": "Maneki", "level": "market", "pos": [35, 6], "dsm": "npcs/maneki.json", "state": "start" },
    169         "fishmonger": { "type": "FishMonger", "level": "fishmonger_house", "pos": [23, 5], "dsm": "npcs/fishmonger.json", "state": "start" },
    170         "actor": { "type": "Actor", "level": "theatre", "pos": [12, 9], "dsm": "npcs/actor.json", "state": "start" },
    171         "kitsune": { "type": "Kitsune", "level": "celestial_plane", "pos": [17, 20], "dsm": "npcs/kitsune.json", "state": "start" }
     159        "monk": { "type": "Monk", "level": "temple", "pos": [15, 16], "dsm": "npcs/monk.json", "state": "start", "facing": null },
     160        "guard": { "type": "Guard", "level": "temple_grounds", "pos": [5, 11], "dsm": "npcs/guard.json", "state": "start", "facing": null, "block": true },
     161        "hattori": { "type": "Hattori", "level": "road", "pos": [37, 8], "dsm": "npcs/hattori.json", "state": "start", "facing": "left", "block": true },
     162        "ichiro": { "type": "Ichiro", "level": "road", "pos": [36, 8], "dsm": "npcs/ichiro.json", "state": "start", "facing": "right", "block": true },
     163        "sasuke": { "type": "Sasuke", "level": "road", "pos": [56, 8], "dsm": "npcs/sasuke.json", "state": "start", "facing": null, "block": true },
     164        "kaneda2": { "type": "Kaneda", "level": "tea_house", "pos": [6, 10], "dsm": "npcs/kaneda2.json", "state": "start", "facing": null },
     165        "tetsuo": { "type": "Tetsuo", "level": "tea_house", "pos": [9, 10], "dsm": "npcs/tetsuo.json", "state": "start" , "facing": null},
     166        "kaneda": { "type": "Kaneda", "level": "geisha_house", "pos": [10, 3], "dsm": "npcs/kaneda.json", "state": "start" , "facing": null},
     167        "kumiko": { "type": "Kumiko", "level": "geisha_room", "pos": [11, 13], "dsm": "npcs/kumiko.json", "state": "start" , "facing": null},
     168        "maneki": { "type": "Maneki", "level": "market", "pos": [35, 6], "dsm": "npcs/maneki.json", "state": "start" , "facing": null},
     169        "fishmonger": { "type": "FishMonger", "level": "fishmonger_house", "pos": [23, 5], "dsm": "npcs/fishmonger.json", "state": "start" , "facing": null},
     170        "actor": { "type": "Actor", "level": "theatre", "pos": [12, 9], "dsm": "npcs/actor.json", "state": "start" , "facing": null},
     171        "kitsune": { "type": "Kitsune", "level": "celestial_plane", "pos": [17, 20], "dsm": "npcs/kitsune.json", "state": "start" , "facing": null}
    172172    },
    173173    "levels": {
  • skaapsteker/sprites/base.py

    r461 r475  
    274274        self._layer = Layers.PLAYER
    275275
    276     def setup(self, name, world, dsm, state):
     276    def setup(self, name, world, dsm, state, facing):
    277277        self.name = name
    278278        self.dsm = dialogue.DSM(name, world, dsm, state)
    279279        self._me = getattr(world.npcs, self.name)
     280        self.facing = facing
    280281
    281282    def player_action(self, player):
     
    289290    block = True
    290291
    291     def setup(self, name, world, dsm, state, block):
    292         NPC.setup(self, name, world, dsm, state)
     292    def setup(self, name, world, dsm, state, facing, block):
     293        NPC.setup(self, name, world, dsm, state, facing)
    293294        self.block = block
    294295        self._animation = 'standing'
  • skaapsteker/sprites/npcs.py

    r468 r475  
    11from .base import NPC, BlockingNPC
     2from pygame import transform
    23
    34
     
    2122class Hattori(BlockingNPC):
    2223    image_dir = 'sprites/hattori'
     24    facings = {
     25            'running' : (('left', None),
     26                ('right', lambda x: transform.flip(x, True, False))),
     27            'standing' : (('left', None),
     28                ('right', lambda x: transform.flip(x, True, False))),
     29                }
     30
    2331
    2432
    2533class Ichiro(BlockingNPC):
    2634    image_dir = 'sprites/ichiro'
     35    facings = {
     36            'running' : (('left', None),
     37                ('right', lambda x: transform.flip(x, True, False))),
     38            'standing' : (('left', None),
     39                ('right', lambda x: transform.flip(x, True, False))),
     40                }
     41
    2742
    2843
Note: See TracChangeset for help on using the changeset viewer.