]> bicyclesonthemoon.info Git - ott/molpy-up/commitdiff
implemented Lucky
authorPeter Gerwinski <peter.gerwinski@hs-bochum.de>
Sat, 31 Mar 2018 20:06:53 +0000 (22:06 +0200)
committerPeter Gerwinski <peter.gerwinski@hs-bochum.de>
Sat, 31 Mar 2018 20:06:53 +0000 (22:06 +0200)
assets/platformLuckyAttacking.png [new file with mode: 0644]
assets/platformLuckySleeping.png [new file with mode: 0644]
molpyup.py

diff --git a/assets/platformLuckyAttacking.png b/assets/platformLuckyAttacking.png
new file mode 100644 (file)
index 0000000..52d4166
Binary files /dev/null and b/assets/platformLuckyAttacking.png differ
diff --git a/assets/platformLuckySleeping.png b/assets/platformLuckySleeping.png
new file mode 100644 (file)
index 0000000..17fb724
Binary files /dev/null and b/assets/platformLuckySleeping.png differ
index bb98165b9a691f84f3300a1635d9f1ea34f90d5e..76a82d9ad79113ef73320e35c628c57e77a512b9 100644 (file)
@@ -49,9 +49,10 @@ class MolpyUp:
     platformTypeWater = 5
     platformTypeRaftcastle = 6
     platformTypeFloating = platformTypeRaftcastle
-    platformTypeBreaking = 7
-    platformTypeTheEnd = 8
-    platformTypeWonTheGame = 9
+    platformTypeLucky = 7
+    platformTypeBreaking = 8
+    platformTypeTheEnd = 9
+    platformTypeWonTheGame = 10
 
     itemTypeAccelerator = 0
     itemTypeBeanie = 1
@@ -67,6 +68,7 @@ class MolpyUp:
     scoreGrass = 2193
     scoreAfterLucky = 2315
     scoreCastle = 2825
+    scoreLucky = 2976
     scoreRaftcastle = 3031
     scoreWater = 3043
     scoreTheEnd = 3089
@@ -97,6 +99,8 @@ class MolpyUp:
                                   pygame.image.load("assets/platformWater2f.png").convert_alpha() ]
         self.imgPlatformAfterLucky = pygame.image.load("assets/platformAfterLucky.png").convert_alpha()
         self.imgPlatformCastle = pygame.image.load("assets/platformCastle.png").convert_alpha()
+        self.imgPlatformLuckySleeping = pygame.image.load("assets/platformLuckySleeping.png").convert_alpha()
+        self.imgPlatformLuckyAttacking = pygame.image.load("assets/platformLuckyAttacking.png").convert_alpha()
         self.imgPlatformRaftcastle = pygame.image.load("assets/platformRaftcastle.png").convert_alpha()
         self.imgPlatformGrapevine = pygame.image.load("assets/platformGrapevine.png").convert_alpha()
         self.imgPlatformBreaking = pygame.image.load("assets/platformBreaking.png").convert_alpha()
@@ -159,6 +163,7 @@ class MolpyUp:
         self.hadPrickly = False
         self.hadAfterLucky = False
         self.hadCastle = False
+        self.hadLucky = False
         self.hadTheEnd = False
         self.raftcastleHasFlag = False
         self.platforms = [[self.playerx, self.playery + self.sy // 6, self.platformTypeSand, 0, 0]]
@@ -256,7 +261,12 @@ class MolpyUp:
                 else:
                     self.jump = self.sy // 20
                     self.gravity = 0
-                    if (p[2] == self.platformTypeAfterLucky or p[2] == self.platformTypeCastle) and self.playerCarriesFlag and not p[-2]:
+                    if p[2] == self.platformTypeLucky and not self.playerCarriesFlag and p[-2] <= 0:
+                        self.xmovement = self.sx // 20
+                        self.direction = 0
+                        self.cameray -= self.sy // 12
+                        p[-2] = -1
+                    elif (p[2] == self.platformTypeAfterLucky or p[2] == self.platformTypeCastle or p[2] == self.platformTypeLucky) and self.playerCarriesFlag and not p[-2]:
                         self.playerCarriesFlag = False
                         p[-2] = True
                         self.sandcastles += 1
@@ -297,6 +307,9 @@ class MolpyUp:
                 elif self.score > self.scoreCastle and not self.hadCastle:
                     self.hadCastle = True
                     return self.platformTypeCastle
+                elif self.score > self.scoreLucky and not self.hadLucky:
+                    self.hadLucky = True
+                    return self.platformTypeLucky
                 else:
                     return self.platformTypeGrass
             else:
@@ -318,6 +331,8 @@ class MolpyUp:
                         self.hadTheEnd = True
                 elif platformType == self.platformTypeWater or platformType == self.platformTypeRaftcastle:
                     self.platforms.append([random.randint(0, self.sx * 7 // 8), self.platforms[-1][1] - self.sy // 8, platformType, False, False])
+                elif platformType == self.platformTypeLucky:
+                    self.platforms.append([0, self.platforms[-1][1] - self.sy // 12, platformType, False, False])
                 else:
                     self.platforms.append([random.randint(0, self.sx * 7 // 8), self.platforms[-1][1] - self.sy // 12, platformType, False, False])
                 if platformType <= self.platformTypeNormal:
@@ -377,6 +392,13 @@ class MolpyUp:
                 if p[-2]:
                     self.screen.blit(self.imgFlagRight, (p[0] + self.imgPlatformCastle.get_width() - 16, p[1] - 4 - self.cameray))
                 self.screen.blit(self.imgPlatformCastle, (p[0], p[1] - self.cameray))
+            elif p[2] == self.platformTypeLucky:
+                if p[-2]:
+                    self.screen.blit(self.imgPlatformLuckyAttacking, (p[0], p[1] - self.imgPlatformLuckyAttacking.get_height() + self.imgPlatformLuckySleeping.get_height() - self.cameray))
+                    if p[-2] > 0:
+                        self.screen.blit(self.imgFlagRight, (p[0] + self.imgPlatformLuckyAttacking.get_width() - 8, p[1] - 11 - self.cameray))
+                else:
+                    self.screen.blit(self.imgPlatformLuckySleeping, (p[0], p[1] - self.cameray))
             elif p[2] == self.platformTypeRaftcastle:
                 if self.raftcastleHasFlag:
                     self.screen.blit(self.imgFlagRight, (p[0] + 50, p[1] - 13 - self.cameray))