diff options
author | Gonzalo Odiard <godiard@gmail.com> | 2012-05-06 05:34:04 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2012-05-06 05:34:04 (GMT) |
commit | a9afa17b71f98e11d546d954f9c9ca61dbb0f105 (patch) | |
tree | 553f4455101c292e34ad5d00946727d6b3794751 /mapnav.py | |
parent | 94d978ebf69146d80bbdeedc6761916446558e4e (diff) |
Comment logging / Improve testing wall functions
Diffstat (limited to 'mapnav.py')
-rw-r--r-- | mapnav.py | 22 |
1 files changed, 9 insertions, 13 deletions
@@ -178,17 +178,20 @@ class MapNavView(gtk.DrawingArea): if self.view_mode == self.MODE_PLAY and not self._is_walking: # verify doors if self._check_over_door(info_walls, event.x, event.y): + logging.error('Door clicked') new_x, new_y, new_direction = self._game_map.cross_door( self.x, self.y, self.direction) self._move_character(event.x, new_x, new_y, new_direction) # verify lateral walls elif self._check_left_wall(event.x): + logging.error('Left wall clicked') new_x, new_y, new_direction = self._game_map.go_left(self.x, self.y, self.direction) self._move_character(0, new_x, new_y, new_direction) elif self._check_right_wall(event.x): + logging.error('Right wall clicked') new_x, new_y, new_direction = self._game_map.go_right(self.x, self.y, self.direction) self._move_character(self._width, new_x, new_y, @@ -205,21 +208,14 @@ class MapNavView(gtk.DrawingArea): door_height = self._grid_size * self._door_height if door_x < x < door_x + door_width and \ door_y < y < door_y + door_height: - logging.error('Door clicked') return True return False def _check_left_wall(self, x): - if x < self._grid_size: - logging.error('Left wall clicked') - return True - return False + return x < self._grid_size def _check_right_wall(self, x): - if x > self._width - self._grid_size: - logging.error('Right wall clicked') - return True - return False + return x > self._width - self._grid_size def _move_character(self, character_destination, new_map_x, new_map_y, new_map_direction): @@ -338,8 +334,8 @@ class MapNavView(gtk.DrawingArea): ctx.rectangle(event.area.x, event.area.y, event.area.width, event.area.height) ctx.clip() - logging.error('expose clipping area %d %d %d %d', event.area.x, - event.area.y, event.area.width, event.area.height) + #logging.error('expose clipping area %d %d %d %d', event.area.x, + # event.area.y, event.area.width, event.area.height) self.draw(ctx, event.area.x, event.area.y, event.area.width, event.area.height) @@ -485,8 +481,8 @@ class MapNavView(gtk.DrawingArea): wall_y + height < clip_y or \ wall_y > clip_y + clip_height: break - logging.error('Drawing object %s at %d %d w %d h %d', - image_file_name, wall_x, wall_y, width, height) + #logging.error('Drawing object %s at %d %d w %d h %d', + # image_file_name, wall_x, wall_y, width, height) ctx.translate(wall_x, wall_y) ctx.scale(scale, scale) |