Changeset 460:8b9b4706a4d6


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

Blocking NPC's block

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • data/game.json

    r456 r460  
    158158    "npcs": {
    159159        "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" },
     160        "guard": { "type": "Guard", "level": "temple_grounds", "pos": [5, 11], "dsm": "npcs/guard.json", "state": "start", "block": true },
    161161        "hattori": { "type": "Hattori", "level": "road", "pos": [36, 8], "dsm": "npcs/hattori.json", "state": "start" },
    162162        "ichiro": { "type": "Ichiro", "level": "road", "pos": [37, 8], "dsm": "npcs/ichiro.json", "state": "start" },
  • skaapsteker/physics.py

    r422 r460  
    314314        # Happens after updates, because we only want it for the next frame.
    315315        for sprite in self._actors:
     316            actor_collide_rect = sprite.collide_rect.inflate((4, 4))
    316317            for other in self._actionables:
    317                 if sprite.collide_rect.colliderect(other.collide_rect):
     318                other_actor_collide_rect = other.collide_rect.inflate((4, 4))
     319                if actor_collide_rect.colliderect(other_actor_collide_rect):
    318320                    sprite.add_actionable(other)
    319321
  • skaapsteker/sprites/base.py

    r441 r460  
    282282
    283283
     284class BlockingNPC(NPC):
     285
     286    collides_with = set([PC_LAYER])
     287    mobile = False
     288    block = True
     289
     290    def setup(self, name, world, dsm, state, block):
     291        NPC.setup(self, name, world, dsm, state)
     292        self.block = block
     293        self._animation = 'standing'
     294
     295
    284296class Projectile(AnimatedGameSprite):
    285297
  • skaapsteker/sprites/npcs.py

    r451 r460  
    1 from .base import NPC
     1from .base import NPC, BlockingNPC
    22
    33
     
    99
    1010
    11 class Guard(NPC):
     11class Guard(BlockingNPC):
    1212    image_dir = 'sprites/guard'
     13
    1314
    1415
Note: See TracChangeset for help on using the changeset viewer.