Beispiel #1
0
    def config(self):
        gridpy.set_dim(self.dim)
        gridpy.set_square_size(GUI.SQUARE_SIZE)
        #gridpy.set_background_color(gridpy.BLACK)
        #gridpy.set_border_colors(gridpy.BLUE, gridpy.BLACK)
        #gridpy.set_border_colors(gridpy.GREY, gridpy.WHITE)
        gridpy.set_fps(GUI.FPS)
        #gridpy.set_style(gridpy.TRIPLE)
        #gridpy.set_style(gridpy.DOUBLE)
        #gridpy.set_style(gridpy.SINGLE)
        #gridpy.set_style(gridpy.NONE)

        gridpy.title(GUI.TITLE % self.dim)
Beispiel #2
0
#!/usr/bin/python2

# - How do we want to add keybindings?
#   - Use pygame.locals
#   - Use ord('K')
#       - Use 'K' and have ord() happen behind the scenes

import gridpy

size = (50, 50)

gridpy.set_dim(size)
#gridpy.set_square_size(1)
gridpy.set_square_size(2)
#gridpy.set_background_color(gridpy.BLACK)
#gridpy.set_border_colors(gridpy.BLUE, gridpy.BLACK)
#gridpy.set_border_colors(gridpy.GREY, gridpy.WHITE)
gridpy.set_fps(999999)
#gridpy.set_style(gridpy.TRIPLE)
#gridpy.set_style(gridpy.DOUBLE)
#gridpy.set_style(gridpy.SINGLE)
#gridpy.set_style(gridpy.NONE)

gridpy.title("A simple demo")
gridpy.show()

def cycle(list):
    while True:
        for item in list:
            yield item
Beispiel #3
0
X...XXXXXXXXXX.XXX..X
X.X.X........X.X.X..X
X.X.XXXXXXXX.X.X.X..X
X.X........X.X.X.X..X
X.X.XXXXXX.X.X.X.X..X
X.X.X....X.X.X.X.X..X
X.X.X.XXXX.X.X.X.X..X
X.X.X......X.X.X.X..X
XAX.XXXXXXXX.XXX.XX.X
X.X.................X
XXXXXXXXXXXXXXXXXXXXX
''').split()

r = len(map)
c = len(map[0])
gridpy.set_dim((c, r))
gridpy.set_square_size(20)

class World:
    def __init__(self, map):
        self.items = {}
        self.rows  = len(map)
        self.cols  = len(map[0])
        
        gridpy.set_fps(10)

        for r in xrange(self.rows):
            for c in xrange(self.cols):
                square = map[r][c]
                pos = (c, r)
                if square == 'A':