def movement(self, direction, x_cor, y_cor, index, type_c): if direction == 'a': if self.Board[x_cor][y_cor - 4] == '#' or self.Board[x_cor][y_cor - 4] == '%': return self.Board else: self.Board[x_cor][y_cor] = ' ' self.Board[x_cor][y_cor + 1] = ' ' self.Board[x_cor][y_cor + 2] = ' ' self.Board[x_cor][y_cor + 3] = ' ' self.Board[x_cor + 1][y_cor] = ' ' self.Board[x_cor + 1][y_cor + 1] = ' ' self.Board[x_cor + 1][y_cor + 2] = ' ' self.Board[x_cor + 1][y_cor + 3] = ' ' y_cor = y_cor - 4 if type_c == 1: b2 = Bomberman(x_cor, y_cor) b21 = b2.create_man(self.Board) self.x_v = x_cor self.y_v = y_cor self.x_b = x_cor self.y_b = y_cor return b21 elif type_c == 2: b3 = Enemy(x_cor, y_cor) b3 = b3.create_enemy(self.Board) self.enemy_array[index] = x_cor self.enemy_array1[index] = y_cor return b3 elif direction == 'd': if self.Board[x_cor][y_cor + 4] == '#' or self.Board[x_cor][y_cor + 4] == '%': return self.Board else: self.Board[x_cor][y_cor] = ' ' self.Board[x_cor][y_cor + 1] = ' ' self.Board[x_cor][y_cor + 2] = ' ' self.Board[x_cor][y_cor + 3] = ' ' self.Board[x_cor + 1][y_cor] = ' ' self.Board[x_cor + 1][y_cor + 1] = ' ' self.Board[x_cor + 1][y_cor + 2] = ' ' self.Board[x_cor + 1][y_cor + 3] = ' ' y_cor = y_cor + 4 if type_c == 1: b2 = Bomberman(x_cor, y_cor) b21 = b2.create_man(self.Board) self.x_v = x_cor self.y_v = y_cor self.x_b = x_cor self.y_b = y_cor return b21 elif type_c == 2: b3 = Enemy(x_cor, y_cor) b3 = b3.create_enemy(self.Board) self.enemy_array[index] = x_cor self.enemy_array1[index] = y_cor return b3 elif direction == 's': if self.Board[x_cor + 2][y_cor] == '#' or self.Board[x_cor + 2][y_cor] == '%': return self.Board else: self.Board[x_cor][y_cor] = ' ' self.Board[x_cor][y_cor + 1] = ' ' self.Board[x_cor][y_cor + 2] = ' ' self.Board[x_cor][y_cor + 3] = ' ' self.Board[x_cor + 1][y_cor] = ' ' self.Board[x_cor + 1][y_cor + 1] = ' ' self.Board[x_cor + 1][y_cor + 2] = ' ' self.Board[x_cor + 1][y_cor + 3] = ' ' x_cor = x_cor + 2 if type_c == 1: b2 = Bomberman(x_cor, y_cor) b21 = b2.create_man(self.Board) self.x_v = x_cor self.y_v = y_cor self.x_b = x_cor self.y_b = y_cor return b21 elif type_c == 2: b3 = Enemy(x_cor, y_cor) b3 = b3.create_enemy(self.Board) self.enemy_array[index] = x_cor self.enemy_array1[index] = y_cor return b3 elif direction == 'w': if self.Board[x_cor - 2][y_cor] == '#' or self.Board[x_cor - 2][y_cor] == '%': return self.Board else: self.Board[x_cor][y_cor] = ' ' self.Board[x_cor][y_cor + 1] = ' ' self.Board[x_cor][y_cor + 2] = ' ' self.Board[x_cor][y_cor + 3] = ' ' self.Board[x_cor + 1][y_cor] = ' ' self.Board[x_cor + 1][y_cor + 1] = ' ' self.Board[x_cor + 1][y_cor + 2] = ' ' self.Board[x_cor + 1][y_cor + 3] = ' ' x_cor = x_cor - 2 if type_c == 1: b2 = Bomberman(x_cor, y_cor) b21 = b2.create_man(self.Board) # b2.set_x_cor(x_cor) # b2.set_y_cor(y_cor) self.x_v = x_cor self.y_v = y_cor self.x_b = x_cor self.y_b = y_cor return b21 elif type_c == 2: b3 = Enemy(x_cor, y_cor) b3 = b3.create_enemy(self.Board) self.enemy_array1[index] = y_cor self.enemy_array[index] = x_cor return b3
def place_man(self): b2 = Bomberman(2, 4) b2 = b2.create_man(self.Board) return b2