Updated BG sprites
This commit is contained in:
+4
-2
@@ -15,6 +15,7 @@ class Background():
|
||||
backgroundImages = (
|
||||
pygame.transform.scale(backgroundImage.subsurface((0, 0, 800, 150)), (3200, 600)),
|
||||
pygame.transform.scale(backgroundImage.subsurface((0, 150, 800, 150)), (3200, 600)),
|
||||
pygame.transform.scale(backgroundImage.subsurface((0, 300, 800, 150)), (3200, 600)),
|
||||
)
|
||||
for image in backgroundImages:
|
||||
image.set_colorkey((255,0,255))
|
||||
@@ -23,8 +24,9 @@ class Background():
|
||||
pygame.sprite.Sprite.__init__(self)
|
||||
|
||||
self.layers = (
|
||||
BackgroundLayer(Background.backgroundImages[0], mainGameClass, 0.5),
|
||||
BackgroundLayer(Background.backgroundImages[1], mainGameClass, 1),
|
||||
BackgroundLayer(Background.backgroundImages[0], mainGameClass, 0.25),
|
||||
BackgroundLayer(Background.backgroundImages[1], mainGameClass, 0.5),
|
||||
BackgroundLayer(Background.backgroundImages[2], mainGameClass, 1),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -18,8 +18,12 @@ class BackgroundLayerFrame(pygame.sprite.Sprite):
|
||||
self.rect.center = (mainGameClass.getScreenWidth()/2 + offset[0],
|
||||
mainGameClass.getScreenHeight()/2 + offset[1])
|
||||
|
||||
self.__doubleX = float(self.rect.x)
|
||||
|
||||
|
||||
def update(self):
|
||||
self.rect.x -= self.mainGameClass.getGameSpeed() * self.speedMultiplier
|
||||
if self.rect.x < -self.rect.width:
|
||||
self.rect.x += self.rect.width*2
|
||||
self.__doubleX -= self.mainGameClass.getGameSpeed() * self.speedMultiplier
|
||||
if self.__doubleX < -self.rect.width:
|
||||
self.__doubleX += self.rect.width*2
|
||||
|
||||
self.rect.x = self.__doubleX
|
||||
|
||||
@@ -11,7 +11,7 @@ class Floor(pygame.sprite.Sprite):
|
||||
pygame.sprite.Sprite.__init__(self)
|
||||
self.image = pygame.Surface((mainGameClass.getScreenWidth(),
|
||||
mainGameClass.getFloorHeight()*101))
|
||||
self.image.fill((255, 204, 102))
|
||||
self.image.fill((255, 229, 180))
|
||||
self.rect = self.image.get_rect()
|
||||
self.rect.center = (mainGameClass.getScreenWidth()/2,
|
||||
mainGameClass.getScreenHeight() +
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 6.5 KiB |
Binary file not shown.
Reference in New Issue
Block a user