Changeset 75:95cb0b575e05


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

Enemies in level editor, tile layers.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • data/levels/level1.json

    r70 r75  
    77        "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    88        "X{.....................................}X{..............................}X",
    9         "X.......................................X................................X",
     9        "X...1...................................X................................X",
    1010        "X.......................................bXXXd=-->........................X",
    1111        "Xd=--------+XXXq.........................................................X",
    1212        "X{..........XXXX.........................................................X",
    13         "X...........XXXX=----------+XXXX=---------------------------------------+X",
     13        "X....-......XXXX=----------+XXXX=---------------------------------------+X",
    1414        "X...........bXXd...........pXXXX.........................................X",
    1515        "X.........................pXXXXX.........................................X",
     
    2121    ],
    2222    "enemies": [
    23         {"type": "Dummy", "pos": [4, 2], "direction": "left" }
     23        {"type": "Dummy", "pos": [4, 2], "direction": "left" },
     24        {"type": "Dummy", "pos": [5, 6], "direction": "right" }
    2425    ],
    2526    "sprites": [
  • scripts/level-editor

    r69 r75  
    5656        level_surface.set_clip(clip_rect)
    5757        level.draw(level_surface)
    58         level.draw_tiles(level_surface)
     58        level.sprites.draw(level_surface)
    5959        screen_surface.blit(level_surface, (0, 0), clip_rect)
    6060
  • skaapsteker/level.py

    r69 r75  
    22
    33from pygame import Rect, Surface
    4 from pygame.sprite import Group
     4from pygame.sprite import LayeredUpdates
    55from pygame.locals import SRCALPHA, HWSURFACE
    66
     
    3131            '{': self.tile_factory('solid-cnr-l.png'),
    3232            '}': self.tile_factory('solid-cnr-r.png'),
     33            '1': self.tile_factory('bonsai.png', layer=Layers.FOREGROUND),
    3334            }
    3435
     
    5354    def __init__(self, leveldef):
    5455        self.level_data = json.loads(data.load('levels/' + leveldef + '.json').read())
    55         self.sprites = Group()
     56        self.sprites = LayeredUpdates()
    5657        self.build_backgrounds()
    5758        self.build_tiles()
     
    6768    def build_tiles(self):
    6869        self.tileset = TileSet(self.level_data['tileset'])
    69         self.tiles = Group()
     70        self.tiles = LayeredUpdates()
    7071        tile_data = self.level_data['tiles']
    7172        self.tile_size = (len(tile_data[0]), len(tile_data))
     
    7778                    self.tiles.add(tile)
    7879                    self.sprites.add(tile)
    79         print "level:", self.tile_size, self.pixel_size
    8080
    8181
    8282    def setup_enemies(self):
    83         self.enemies = Group()
     83        self.enemies = LayeredUpdates()
    8484        for enemy_def in self.level_data['enemies']:
    8585            enemy = enemies.get_enemy(enemy_def)
Note: See TracChangeset for help on using the changeset viewer.