Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/DrawableObjectTests/boxes.py
diff options
context:
space:
mode:
Diffstat (limited to 'DrawableObjectTests/boxes.py')
-rw-r--r--DrawableObjectTests/boxes.py32
1 files changed, 0 insertions, 32 deletions
diff --git a/DrawableObjectTests/boxes.py b/DrawableObjectTests/boxes.py
deleted file mode 100644
index 5b444b6..0000000
--- a/DrawableObjectTests/boxes.py
+++ /dev/null
@@ -1,32 +0,0 @@
-import pygame
-
-class UpDownBox(pygame.sprite.Sprite):
- def __init__(self, imagesList, initial_position):
- pygame.sprite.Sprite.__init__(self)
- self.images = imagesList
- self.listLen = len(imagesList)
- self.listPos = 0
- self.image = imagesList[self.listPos]
- self.rect = self.image.get_rect()
- self.rect.topleft = initial_position
- self.going_down = True # Start going downwards
- self.next_update_time = 0 # update() hasn't been called yet.
-
- def update(self, current_time, bottom):
- # Update every 10 milliseconds = 1/100th of a second.
- if self.next_update_time < current_time:
-
- # If we're at the top or bottom of the screen, switch directions.
- if self.rect.bottom == bottom - 1: self.going_down = False
- elif self.rect.top == 0: self.going_down = True
-
- # Move our position up or down by one pixel
- if self.going_down: self.rect.top += 1
- else: self.rect.top -= 1
-
- if self.listPos < self.listLen - 1:
- self.listPos += 1
- else:
- self.listPos = 0
- self.image = self.images[self.listPos]
- self.next_update_time = current_time