all repos — Legends-RPG @ 1656028d833a30e65fbd49c15f84a6bc758ab29e

A fantasy mini-RPG built with Python and Pygame.

Began fleshing out the map some more
Justin Armstrong justinmeister@gmail.com
Thu, 06 Mar 2014 23:41:46 -0800
commit

1656028d833a30e65fbd49c15f84a6bc758ab29e

parent

cfe27f199eb035566a7a0cb057b3d0c482ee51c8

3 files changed, 30 insertions(+), 17 deletions(-)

jump to
M data/components/player.pydata/components/player.py

@@ -11,8 +11,9 @@ self.get_image = setup.tools.get_image

self.spritesheet_dict = self.create_spritesheet() self.animation_lists = self.create_animation_lists() self.index = 1 - self.image_list = self.animation_lists['down'] - self.image = self.spritesheet_dict['facing down 1'] + self.direction = 'up' + self.image_list = self.animation_lists[self.direction] + self.image = self.image_list[self.index] self.rect = self.image.get_rect() self.state_dict = self.create_state_dict() self.direction_dict = self.create_direction_dict()
M data/states/town.pydata/states/town.py

@@ -28,19 +28,23 @@

def create_town_sprite_sheet_dict(self): """Create a dictionary of sprite sheet tiles""" dict = {} + tileset1 = setup.GFX['tileset1'] tileset2 = setup.GFX['tileset2'] + dict['pavement'] = self.get_tile(32, 48, tileset2) dict['house wall'] = self.get_tile(64, 48, tileset2) dict['house roof'] = self.get_tile(0, 144, tileset2) dict['house door'] = self.get_tile(48, 64, tileset2) + dict['tree'] = self.get_tile(80, 48, tileset1, 16, 32) + dict['well'] = self.get_tile(96, 50, tileset1, 16, 32) return dict - def get_tile(self, x, y, tileset): + def get_tile(self, x, y, tileset, width=16, height=16): """Gets the surface and rect for a tile""" - surface = self.get_image(self, x, y, 16, 16, tileset) + surface = self.get_image(self, x, y, width, height, tileset) rect = surface.get_rect() dict = {'surface': surface,

@@ -98,6 +102,14 @@ self.blit_tile_to_map(tile, row, column, map)

elif letter == '3': tile = self.town_map_dict['house roof'] + self.blit_tile_to_map(tile, row, column, map) + + elif letter == 'T': + tile = self.town_map_dict['tree'] + self.blit_tile_to_map(tile, row, column, map) + + elif letter == 'W': + tile = self.town_map_dict['well'] self.blit_tile_to_map(tile, row, column, map) tile_map.close()
M data/states/town_map.txtdata/states/town_map.txt

@@ -34,17 +34,17 @@ 0000000000011000000000000

0000000000011000000000000 0000000000011000000000000 0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000333000 -0003330000011000000333000 -0003330000011000000222000 -0002220000011000000222000 -0002220000011000000010000 -0000100000011000000010000 -0000111111111111111110000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 +T0T0T00000011000000000000 +0T0T000000011000000000000 +T0T0000000011000000333000 +0T03330000011000000333000 +T0T3330000011000000222000 +0T02220000011000000222000 +T0T2220000011000000010000 +0T00100000011000000010000 +T0T0111111111111111110000 +0T00000000011000000000000 +T0T0T00W00011000000000000 +000T000000011000000000000 +0T000T0000011000000T00000 0000000000011000000000000