def test_enemy_movement(self): enemy_regular = tank.Enemy(10, 12, 10, "regular") enemy_fast = tank.Enemy(10, 10, 10, "fast") enemy_heavy = tank.Enemy(12, 10, 10, "heavy") dir = enemy_fast.make_move(enemy_heavy) self.assertTrue(dir == "left") dir = enemy_heavy.make_move(enemy_fast) self.assertTrue(dir == "right") dir = enemy_regular.make_move(enemy_fast) self.assertTrue(dir == "up") dir = enemy_fast.make_move(enemy_regular) self.assertTrue(dir == "down")
def test_enemy_shooting(self): enemy_regular = tank.Enemy(10, 12, 10, "regular") enemy_fast = tank.Enemy(10, 10, 10, "fast") enemy_heavy = tank.Enemy(12, 10, 10, "heavy") enemy_fast.shoot(enemy_regular, "up") self.assertTrue(len(enemy_fast.missiles) == 1) enemy_fast.shoot(enemy_regular, "left") self.assertTrue(len(enemy_fast.missiles) == 1) enemy_fast.shoot(enemy_regular, "right") self.assertTrue(len(enemy_fast.missiles) == 1) enemy_fast.shoot(enemy_regular, "down") self.assertTrue(len(enemy_fast.missiles) == 1)
def test_bullets_movement(self): player = tank.Player(0, 0, 0, 20, 100, "radiant") enemy = tank.Enemy(30, 30, 0, "regular") missile = go.Missile(0, 0, 16, 2, 2) player.missiles.append(missile) game_display = s.GAME_DISPLAY camera = go.Camera(500, 500) castle = go.Castle(20, 20, 16, "alive", "dire") cliient.move_bullets(player, enemy, castle, game_display, camera) missile1 = go.Missile(30, 30, 16, 2, 2) player.missiles.append(missile1) cliient.move_bullets(player, enemy, castle, game_display, camera) missile2 = go.Missile(20, 20, 16, 2, 2) player.missiles.append(missile2) cliient.move_bullets(player, enemy, castle, game_display, camera) self.assertTrue(True)
def test_enemy_diff(self): enemy_fast = tank.Enemy(10, 10, 10, "fast") enemy_heavy = tank.Enemy(10, 10, 10, "heavy") self.assertTrue(len(enemy_fast.missiles) == 0)
def test_tank_explodes(self): enemy = tank.Enemy(50, 50, 50, 'regular') camera = g.Camera(100, 100) game_display = s.GAME_DISPLAY enemy.draw_explosion(game_display, camera) self.assertTrue(True)
def test_tank(self): enemy = tank.Enemy(50, 50, 50, 'regular') camera = g.Camera(100, 100) game_display = s.GAME_DISPLAY enemy.draw(game_display, s.ENEMY_HEAVY_SPRITE, camera) self.assertTrue(True)
def test_crossing_function(self): client = t.Client(0) enemy = tank.Enemy(50, 50, 50, 'regular') player = tank.Player(50, 50, 8, 50, 100, 'radiant') self.assertTrue(client.has_crossing(enemy, player, 50))
def test_client_inside_boundaries(self): client = t.Client(0) enemy = tank.Enemy(50, 50, 50, 'regular') self.assertTrue(t.inside_boundaries(enemy))