Created
August 18, 2011 20:14
-
-
Save djanatyn/1155064 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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