Exemplo n.º 1
0
Arquivo: game.py Projeto: v/blockade
tokens.append(bcircle)
tokens.append(rcircle)


b.valid_paths = None

while running:
	event = sf.Event()
	while window.GetEvent(event):
		if event.Type == sf.Event.Closed:
			running = False
		if event.Type == sf.Event.MouseButtonPressed:
			for token in tokens:				
				if token.mouse_over(InputHandler, window):
					token.dragged = True
					if token.i >= 0 and token.j >= 0:
						b.grid[token.i][token.j] = None

					if token.type == 'rect':
						b.invalid = b.find_critical_nodes(b.valid_paths)
						print b.invalid
		if event.Type == sf.Event.MouseButtonReleased:
			for token in tokens:
				if token.dragged:
					token.dragged = False
					b.snap(window, token)
					b.invalid = set()
					b.valid_paths =  b.get_valid_paths()
	window.Clear()
	b.draw(window)