Added soldiers, modified castle
Justin Armstrong justinmeister@gmail.com
Mon, 10 Mar 2014 20:16:50 -0700
7 files changed,
91 insertions(+),
54 deletions(-)
M
data/components/person.py
→
data/components/person.py
@@ -212,7 +212,7 @@
class Soldier(Person): """Soldier for the castle""" - def __init__(self): + def __init__(self, x, y): super(Soldier, self).__init__('soldier', x, y)
M
data/states/sprite_start_pos.txt
→
data/states/sprite_start_pos.txt
@@ -1,50 +1,50 @@
0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 +00C00C00C00C00C00C0C00000 +00V000000000000000000V000 +00V000011111111110000V000 +00V000011111111110000V000 +00V000011111111110000V000 +00V000011111111110000V000 +0TV0000000S00S0000000V000 +00V000000000000000000V000 +00C00C00C0000C00C00C00000 0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000F00000 -0000000000011000000000000 +00000000000BB000000000000 +MMMMMMMMMMMBBMMMMMMMMMMMM +T000000000S00S0000000000T 0000000000011000000000000 +T00000000001100000000000T 0000000000011000000000000 -0000000000011000000333000 -0003330000011000000333000 -0003330000011000000222000 -0002220000011000000222000 -0002220000011000000010000 -0000100000011000000010000 -0000111111111111111110000 +T00000000001100000000000T 0000000000011000000000000 +T33303330001100003330333T +0333033300011000033303330 +T22202220001100002220222T +0222022200011000022202220 +T01000100001100000100010T +0T111111111111111111111T0 +T00000000001100000000000T +0T000000000110000000000T0 +T0T00000001GG100000000T0T +0T0T000001GGGG1000000T0T0 +T0T00T00001GG1000000T0T0T +0T000000000110000000000T0 0000000000011000000000000 -0000000000011000000000000 -0000000F00011000000000000 +MMMMMMMMMMM11MMMMMMMMMMMM +0T000000000110000000000T0 +T00000000001100000000000T +0T000000000110000000000T0 +T0T0T0000001100000000000T +0T0T0000000110000000000T0 +T0T0000000011000000333T0T +0T033300000110000003330T0 +T0T3330000011000F00222T0T +0T022200000110000002220T0 +T0T2220000011000000010T0T +0T0010000001100000001T0T0 +T0T0111111111111111110T0T +0T0000000001100000000T0T0 +T0T0T00W000110000000T0T0T +000T00000001100000000T0T0 +0T000T00F0011000000T00T00 00000000000P1000000000000
M
data/states/town.py
→
data/states/town.py
@@ -41,6 +41,7 @@ sword = setup.GFX['sword']
shield = setup.GFX['shield'] potion = setup.GFX['potion'] gem = setup.GFX['gem'] + castle_door = setup.GFX['castledoor'] tile_dict['pavement'] = self.get_tile(32, 48, tileset2) tile_dict['house wall'] = self.get_tile(64, 48, tileset2)@@ -65,7 +66,14 @@ tile_dict['main castle roof'] = self.get_tile(0, 0, tileset1, 160, 16)
tile_dict['left castle roof piece'] = self.get_tile(0, 0, tileset1, 48, 16) tile_dict['right castle roof piece'] = self.get_tile(112, 0, tileset1, 48, 16) tile_dict['castle side'] = self.get_tile(0, 72, tileset3) - tile_dict['castle door'] = self.get_tile(32, 64, tileset2, 16, 16, 4) + tile_dict['castle door'] = self.get_tile(0, 0, castle_door, 64, 96) + tile_dict['carpet topleft'] = self.get_tile(112, 112, tileset2) + tile_dict['carpet topright'] = self.get_tile(144, 112, tileset2) + tile_dict['carpet bottomleft'] = self.get_tile(112, 144, tileset2) + tile_dict['carpet bottomright'] = self.get_tile(144, 144, tileset2) + tile_dict['carpet left'] = self.get_tile(112, 128, tileset2) + tile_dict['carpet right'] = self.get_tile(144, 128, tileset2) + tile_dict['castle window'] = self.get_tile(128, 59, tileset1) return tile_dict@@ -73,7 +81,7 @@
def get_tile(self, x, y, tileset, width=16, height=16, scale=1): """Gets the surface and rect for a tile""" surface = self.get_image(self, x, y, width, height, tileset) - surface = pg.transform.scale(surface, (width*scale, height*scale)) + surface = pg.transform.scale(surface, (int(width*scale), int(height*scale))) rect = surface.get_rect() tile_dict = {'surface': surface,@@ -166,6 +174,30 @@ elif letter == 'S':
tile = self.town_map_dict['castle side'] self.blit_tile_to_map(tile, row, column, map) + elif letter == 'Q': + tile = self.town_map_dict['carpet topleft'] + self.blit_tile_to_map(tile, row, column, map) + + elif letter == 'E': + tile = self.town_map_dict['carpet topright'] + self.blit_tile_to_map(tile, row, column, map) + + elif letter == 'R': + tile = self.town_map_dict['carpet bottomleft'] + self.blit_tile_to_map(tile, row, column, map) + + elif letter == 'U': + tile = self.town_map_dict['carpet bottomright'] + self.blit_tile_to_map(tile, row, column, map) + + elif letter == 'P': + tile = self.town_map_dict['carpet left'] + self.blit_tile_to_map(tile, row, column, map) + + elif letter == 'A': + tile = self.town_map_dict['carpet right'] + self.blit_tile_to_map(tile, row, column, map) + tile_map.close()@@ -210,6 +242,9 @@ tile = self.town_map_dict['tree']
self.blit_tile_to_map(tile, row, column, map) elif letter == 'O': tile = self.town_map_dict['castle door'] + self.blit_tile_to_map(tile, row, column, map) + elif letter == 'Q': + tile = self.town_map_dict['castle window'] self.blit_tile_to_map(tile, row, column, map) tile_map.close()@@ -298,6 +333,9 @@ self.player.rect = pg.Rect(column*32, row*32, 32, 32)
elif letter == 'F': fem_villager = person.FemaleVillager(column*32, row*32) self.town_sprites.add(fem_villager) + elif letter == 'S': + soldier = person.Soldier(column*32, row*32) + self.town_sprites.add(soldier) tile_map.close()@@ -319,7 +357,6 @@ """Blits all images to screen"""
self.level_surface.blit(self.town_map['surface'], self.viewport, self.viewport) self.level_surface.blit(self.player.image, self.player.rect) self.town_sprites.draw(self.level_surface) - surface.blit(self.level_surface, (0,0), self.viewport)
M
data/states/town_layer2.txt
→
data/states/town_layer2.txt
@@ -1,8 +1,8 @@
#TC00C00C00000C00C0CT000# 000000000L00R0000000000#0 #0W0000M0000000000000W#0# -0#W0000000O0000000000W0#0 -#0V000T000000000T0000V#0# +0#W000000000000000000W0#0 +#0V000T00Q0O00Q0T0000V#0# 0#V000000000000000000V0#0 #0V000000000000000000V#0# 00V000000000000000000V0#0
M
data/states/town_map.txt
→
data/states/town_map.txt
@@ -4,11 +4,11 @@ 00V000000000000000000V000
00V0000SSSSSSSSSS0000V000 00V0000SSSSSSSSSS0000V000 00V0000SSSSSSSSSS0000V000 -00V0000SSSSSSSSSS0000V000 -0TV000000000000000000V000 -00V000000000000000000V000 -00C00C00C0000C00C00C00000 -0000000000000000000000000 +00V0000SSSSQESSSS0000V000 +0TV00000000PA00000000V000 +00V00000000PA00000000V000 +00C00C00C00PAC00C00C00000 +00000000000RU000000000000 00000000000BB000000000000 MMMMMMMMMMMBBMMMMMMMMMMMM T00000000000000000000000T