Exemplo n.º 1
0
screen = pygame.display.set_mode(windowSize)

clock = pygame.time.Clock()
pygame.mouse.set_visible(False)

selection = None
draw_selection = False
drawn_selections = []
active_build = None
build_time_offset = 0
Constants.FONT = pygame.font.Font(font_index['KnowYourProduct'], 24)
pygame.display.set_caption('Mootiny')

# Entities:
MG = MovementGrid()
weather = Weather()
EM = EntityManager()
for i in range(10):
    EM.create_non_interactive(Grass())

EM.create_random_cow()
EM.create_random_cow()
EM.create_random_cow()
EM.create_random_cow()

# Interface:
bar = interface.InterfaceBar()


def draw_entities(entities_iterable):
Exemplo n.º 2
0
 def test_open_list(self):
     mg = MovementGrid(10, 10, 5)
     self.assertEqual([(0, 0), (1, 0), (0, 1), (1, 1)], mg.open_list)
Exemplo n.º 3
0
 def test_close_square(self):
     mg = MovementGrid(10, 10, 5)
     mg.close_square((1, 0))
     self.assertIn((1, 0), mg.closed_list)
Exemplo n.º 4
0
 def setUp(self):
     pygame.init()
     self.MG = MovementGrid()
Exemplo n.º 5
0
 def test_a_star_straight_horizontal_large_with_closed_squares(self):
     mg = MovementGrid()
     self.assertEqual(mg.a_star((3, 3), (0, 0)), [(0, 0), (1, 1), (2, 2),
                                                  (3, 3)][::-1])
Exemplo n.º 6
0
 def test_a_star_straight_diagonal_reverse(self):
     mg = MovementGrid(10, 10, 5)
     self.assertEqual(mg.a_star((3, 3), (0, 0)), [(0, 0), (1, 1), (2, 2),
                                                  (3, 3)][::-1])
Exemplo n.º 7
0
 def test_a_star_straight_vertical(self):
     mg = MovementGrid(10, 10, 5)
     self.assertEqual(mg.a_star((0, 0), (3, 0)), [(0, 0), (1, 0), (2, 0),
                                                  (3, 0)])
Exemplo n.º 8
0
 def test_a_star_straight_horizontal(self):
     mg = MovementGrid(10, 10, 5)
     self.assertEqual(mg.a_star((0, 0), (0, 5)), [(0, 0), (0, 1), (0, 2),
                                                  (0, 3), (0, 4), (0, 5)])