diff options
author | Manuel Quiñones <manuq@laptop.org> | 2012-05-30 22:20:36 (GMT) |
---|---|---|
committer | Manuel Quiñones <manuq@laptop.org> | 2012-05-30 22:20:36 (GMT) |
commit | ad437b110f17addb8229ce8a9967ef62a3f42000 (patch) | |
tree | 8eddb6afbeb62f75c1e7471775ed142ed5a1ef62 | |
parent | a0552a111aa70fadc214e10e7b072183cea7f088 (diff) |
Move accelerometer display and remove unneeded code
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
-rwxr-xr-x | game.py | 25 |
1 files changed, 11 insertions, 14 deletions
@@ -163,26 +163,23 @@ class TiltGame(object): # Success! Restart self._ball.set_position(*self._level.get_ball_start()) - # Get the position of the accelerometer - x, y, z = self.accelerometer.read() - font = pygame.font.Font(pygame.font.get_default_font(), 18) - surface_x = font.render('X: %s' % x, True, (0, 0, 0)) - surface_y = font.render('Y: %s' % y, True, (0, 0, 0)) - surface_z = font.render('Z: %s' % z, True, (0, 0, 0)) - self._screen.blit(surface_x, (15, 15)) - self._screen.blit(surface_y, (15, surface_x.get_height() + 15)) - self._screen.blit(surface_z, - (15, surface_x.get_height() * 2 + 15)) - - if self._level.is_on_hole(self.ball.get_position()): - self.ball.set_position(self._level.get_ball_start()) - if self._level.is_on_ground(self._ball.get_position()): self._ball.update() else: # Fail! Restart self._ball.set_position(*self._level.get_ball_start()) + # Get the position of the accelerometer + x, y, z = self.accelerometer.read() + font = pygame.font.Font(pygame.font.get_default_font(), 18) + surface_x = font.render('X: %s' % x, True, (0, 0, 0)) + surface_y = font.render('Y: %s' % y, True, (0, 0, 0)) + surface_z = font.render('Z: %s' % z, True, (0, 0, 0)) + self._screen.blit(surface_x, (15, 15)) + self._screen.blit(surface_y, (15, surface_x.get_height() + 15)) + self._screen.blit(surface_z, + (15, surface_x.get_height() * 2 + 15)) + # Clear Display self._screen.fill(BACKGROUND_COLOR) |