Changeset 463:11eaf0d3e612


Ignore:
Timestamp:
09/07/13 13:59:28 (8 years ago)
Author:
Simon Cross <hodgestar@…>
Branch:
default
Phase:
public
Rebase:
39373036613233396636623832336233396164323035366133623263353338323030623966386137
Message:

Fix boogs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/area_editor.py

    r462 r463  
    144144                break
    145145            if move_poly_mode and index == self._move_poly and move_point:
    146                 pointlist = [p for p in self.translate_poly(
    147                              polygon, move_point, mouse_pos)]
     146                new_point = self.point_to_pymunk(mouse_pos)
     147                pointlist = [self.point_to_pygame(p)
     148                             for p in self.translate_poly(
     149                                 polygon, move_point, new_point)]
    148150                pygame.draw.lines(self._surface, color, False, pointlist,
    149151                                  line_width)
    150                 break
     152                #break
    151153            if len(polygon) > 1:
    152154                pointlist = [self.point_to_pygame(p) for p in polygon]
     
    228230    def find_vertex(self, mouse_pos):
    229231        # search for vertexes closest to where we've killed
    230         mindist = 400
     232        mindist = 1000
    231233        move_point = None
    232234        search_point = self.point_to_pymunk(mouse_pos)
     
    248250        return move_point
    249251
    250     def translate_poly(self, poly, move_point, mouse_point):
    251         print "Translate!"
    252         dx = mouse_point[0] - move_point[0]
    253         dy = mouse_point[1] - move_point[1]
     252    def translate_poly(self, poly, move_point, new_point):
     253        dx = new_point[0] - move_point[0]
     254        dy = new_point[1] - move_point[1]
    254255        new_poly = [(p[0] + dx, p[1] + dy) for p in poly]
    255256        return new_poly
    256257
    257     def replace_poly(self, old_point, new_point):
    258         print "Replace!", self._move_poly
     258    def replace_poly(self, move_point, new_point):
    259259        new_point = self.point_to_pymunk(new_point)
    260260        if self._move_poly:
    261261            self.polygons[self._move_poly] = self.translate_poly(
    262                 self.polygons[self._move_poly], old_point, new_point)
     262                self.polygons[self._move_poly], move_point, new_point)
    263263
    264264    def replace_vertex(self, old_point, new_point):
     
    621621        corrected_pos = self._level_coordinates(ev.pos)
    622622        snapped_pos = self.snap_to_grid(corrected_pos)
    623         print self._move_poly_mode, ev.button, self._move_point
    624623        if self.sel_mode and ev.button == 1:
    625624            obj = self.level.find_obj_at_pos(corrected_pos)
     
    635634                # find the current point
    636635                self._move_point = self.level.find_vertex(snapped_pos)
    637                 print "NEW MOV:", self._move_point
    638636        elif self._move_point_mode and ev.button == 1:
    639637            if self._move_point:
Note: See TracChangeset for help on using the changeset viewer.