Changeset 25:fe87d828d093


Ignore:
Timestamp:
Apr 3, 2011, 4:04:36 PM (9 years ago)
Author:
Jeremy Thurgood <firxen@…>
Branch:
default
Message:

Very basic enemy support.

Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • data/levels/level1.json

    r13 r25  
    6464        "..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..",
    6565        ".........................................................................."
     66    ],
     67    "enemies": [
     68        {"type": "Dummy", "pos": [2, 2], "direction": "left" }
    6669    ]
    6770}
  • skaapsteker/level.py

    r24 r25  
    44
    55import data
     6from sprites import enemies
    67
    78
     
    4142        self.build_background()
    4243        self.build_tiles()
     44        self.setup_enemies()
    4345
    4446
     
    5658        self.level_size = (len(self.tiles[0]) * TILE_SIZE[0], len(self.tiles) * TILE_SIZE[1])
    5759        print "level:", self.level_size
     60
     61
     62    def setup_enemies(self):
     63        self.enemies = []
     64        for enemy in self.level_data['enemies']:
     65            self.enemies.append(enemies.get_enemy(enemy))
    5866
    5967
  • skaapsteker/sprites/base.py

    r22 r25  
    55
    66class Monster(Sprite):
    7     pass
     7    def __init__(self, pos, **opts):
     8        Sprite.__init__(self)
     9        self.starting_tile_pos = pos
     10        self.setup(**opts)
     11
     12
     13    def setup(self):
     14        pass
    815
    916
Note: See TracChangeset for help on using the changeset viewer.