Skip to content

Instantly share code, notes, and snippets.

@djanatyn
Created August 18, 2011 20:14
Show Gist options
  • Save djanatyn/1155064 to your computer and use it in GitHub Desktop.
Save djanatyn/1155064 to your computer and use it in GitHub Desktop.
import pygame
pygame.init()
clock = pygame.time.Clock()
size = 100, 100
screen = pygame.display.set_mode(size)
wall = pygame.image.load("wall.png")
floor = pygame.image.load("floor.png")
map = [
[1,1,1,1,1],
[1,0,0,0,1],
[1,0,1,0,1],
[1,0,0,0,1],
[1,1,1,1,1]]
row = 0; column = 0
for maprow in map:
column = 0
for tile in maprow:
print "%s at coords (%s,%s)" % (tile,column,row)
if tile == 1:
screen.blit(wall,[column * 20, row * 20])
elif tile == 0:
screen.blit(floor,[column * 20, row * 20])
column += 1
row += 1
pygame.display.flip()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment