diff --git a/__init__.py b/__init__.py index 6d19211..96f7202 100644 --- a/__init__.py +++ b/__init__.py @@ -122,13 +122,12 @@ class Quox(Application): def add_boxes(self, state): for i, button in enumerate(state.captouch.petals): - box = Quox.BOX_COORDS[i] if button.pressed: - if box not in self.boxes: - self.boxes.append(box) + if i not in self.boxes: + self.boxes.append(i) else: - if box in self.boxes: - self.boxes.remove(box) + if i in self.boxes: + self.boxes.remove(i) def update_delay(self, Δ): self.turn_delay -= Δ @@ -191,7 +190,7 @@ class Quox(Application): def target(self): if self.boxes: - return self.boxes[0] + return Quox.BOX_COORDS[self.boxes[0]] else: return None @@ -214,8 +213,8 @@ class Quox(Application): def update_leds(self): leds.set_all_rgb(0, 0, 0) - for i, box in enumerate(Quox.BOX_COORDS): - if box in self.boxes: + for i in range(10): + if i in self.boxes: center = i * 4 left = (center - 1) % 40 right = (center + 1) % 40