Пример #1
0
    def main():
        # unit 1
        (x,y) = functions.display_coordinates(game,units.unit1.location,units.unit1.size[1]) # Calculate location in pixels
        gameDisplay.blit(units.unit1.image,(x,y))

        # unit 2
        (x,y) = functions.display_coordinates(game,units.unit2.location,units.unit2.size[1]) # Calculate location in pixels
        gameDisplay.blit(units.unit2.image,(x,y))

        # Update display
        pygame.display.update() # Alternative: pygame.display.flip()
Пример #2
0
def generate_map(gameDisplay,game,background):
        # Generate the map

        for x in range(0,game.number_tilesX):

            for y in range(0,game.number_tilesY):

                # Location of tile
                s = functions.display_coordinates(game,[x*game.tile_size[0],y*game.tile_size[1]],background.size[1])

                if background.tilemap_layout[y][x] == 1:
                    # Lay grass tile
                    gameDisplay.blit(background.tile_1,s)

                elif background.tilemap_layout[y][x] == 0:
                    # Lay rock tile
                    gameDisplay.blit(background.tile_2,s)