Exemplo n.º 1
0
 def break_block(self, player, mouse_pos, viewport):
     angle = self.find_angle(player, mouse_pos, viewport)
     block_pos = Convert.pixels_to_world(self.find_pos(angle, player.pixel_pos(True), Convert.viewport_to_pixels(mouse_pos, viewport), player.get_break_distance())) #it aint right
     chunk = self.loaded_chunks.get(Convert.world_to_chunk(block_pos[0])[1])
     block = self.get_block(block_pos)
     if block["breakable"]:
         chunk.blocks[block_pos[1]][Convert.world_to_chunk(block_pos[0])[0]] = get_block("water")
         chunk.entities.append(BlockDrop.BlockDrop(block_pos, block["name"]))
Exemplo n.º 2
0
 def find_angle_pos(self, mouse_pos, viewport):
     angle = self.find_angle(mouse_pos, viewport)
     return Convert.pixels_to_world(self.find_pos(angle, self.pixel_pos(True), Convert.viewport_to_pixels(mouse_pos, viewport), self.get_break_distance()))