Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

unbroke

  • Loading branch information...
commit 07c7e11ae9b4773ca5b9e682e88670ce209a9f36 1 parent 64ee89b
@tbaugis authored
Showing with 9 additions and 9 deletions.
  1. +6 −5 main.py
  2. +1 −0  waypoints/__init__.py
  3. +2 −4 waypoints/bucket.py
View
11 main.py
@@ -70,10 +70,11 @@ def __init__(self):
- def on_mouse_click(self, area, coords, areas):
- if not areas:
- self.waypoints.append(Waypoint(*coords))
- self.redraw_canvas()
+ def on_mouse_click(self, scene, event, sprite):
+ if not sprite:
+ new_waypoint = wp.Waypoint(event.x, event.y)
+ self.waypoints.append(new_waypoint)
+ self.add_child(new_waypoint)
def on_enter_frame(self, scene, context):
@@ -129,7 +130,7 @@ def on_enter_frame(self, scene, context):
- self.redraw_canvas()
+ self.redraw()
View
1  waypoints/__init__.py
@@ -5,6 +5,7 @@
class Waypoint(graphics.Sprite):
def __init__(self, x, y, **kwargs):
graphics.Sprite.__init__(self, x, y, **kwargs)
+ self.interactive = True
self.draggable = True
self.location = Vector2(x, y)
self.draw_waypoint()
View
6 waypoints/bucket.py
@@ -14,10 +14,6 @@ def __init__(self, x, y, bucket_size):
self.rotation_angle = 0
self.radius = 80
self.incremental_angle = False
- self.connect("on-draw", self.on_draw)
-
- def on_draw(self, waypoint):
- self.rotation += 0.02
def draw_waypoint(self):
self.image = cairo.ImageSurface.create_from_png("images/circle.png");
@@ -42,6 +38,8 @@ def see_you(self, boid):
def update(self, context):
+ self.rotation += 0.02
+
if len(self.boids) == self.bucket_size:
self.boids_out = list(self.boids)
self.boids = []
Please sign in to comment.
Something went wrong with that request. Please try again.