]> bicyclesonthemoon.info Git - ott/molpy-up/commitdiff
platform displaying
authorb <rowerynaksiezycu@gmail.com>
Sat, 28 Mar 2026 07:23:44 +0000 (08:23 +0100)
committerb <rowerynaksiezycu@gmail.com>
Sat, 28 Mar 2026 07:23:44 +0000 (08:23 +0100)
molpyup.py

index 4f33eaf32fdbf81587fbd136c8abd70d5ee0a407..57f5f8f707a1215818466d3c2fb616ba746eddc1 100644 (file)
@@ -181,6 +181,7 @@ class MolpyUp:
             self.imgPlatformWonTheGame.get_height(),
             self.imgPlatformFrame1.get_height()
         ]
+        self.platformLuckyAttackingHeight = self.imgPlatformLuckyAttacking.get_height(),
         self.platformWidth = [
             self.imgPlatformSand[0].get_width(),
             self.imgPlatformGrass[0].get_width(),
@@ -195,6 +196,20 @@ class MolpyUp:
             self.imgPlatformWonTheGame.get_width(),
             self.imgPlatformFrame1.get_width()
         ]
+        self.imgPlatform = [
+            self.imgPlatformSand,
+            self.imgPlatformGrass,
+            self.imgPlatformGrapevine,
+            self.imgPlatformAfterLucky,
+            self.imgPlatformCastle,
+            self.imgPlatformWater,
+            self.imgPlatformRaftcastle,
+            [self.imgPlatformLuckySleeping, self.imgPlatformLuckyAttacking],
+            [self.imgPlatformBreaking, self.imgPlatformBroken],
+            self.imgPlatformTheEnd,
+            self.imgPlatformWonTheGame,
+            self.imgPlatformFrame1
+        ]
         self.dropLimit = 25
         if self.dropLimit >= self.platformHeight[self.platformTypeSand] + self.playerHeight:
             self.dropLimit = self.platformHeight[self.platformTypeSand] + self.playerHeight - 1
@@ -726,42 +741,35 @@ class MolpyUp:
 
     def drawPlatforms(self):
         for p in self.platforms:
-            if p[2] == self.platformTypeSand:
-                self.screen.blit(self.imgPlatformSand[p[4]], (p[0], p[1] - self.cameray))
-            elif p[2] == self.platformTypeGrass:
-                self.screen.blit(self.imgPlatformGrass[p[4]], (p[0], p[1] - self.cameray))
-            elif p[2] == self.platformTypeWater:
-                self.screen.blit(self.imgPlatformWater[p[4]], (p[0], p[1] - self.cameray))
-            elif p[2] == self.platformTypeGrapevine:
-                self.screen.blit(self.imgPlatformGrapevine, (p[0], p[1] - self.cameray))
-            elif p[2] == self.platformTypeAfterLucky:
-                if p[3]:
-                    self.screen.blit(self.imgFlagRight, (p[0] + 47, p[1] - 12 - self.cameray))
-                self.screen.blit(self.imgPlatformAfterLucky, (p[0], p[1] - self.cameray))
-            elif p[2] == self.platformTypeCastle:
-                if p[3]:
-                    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))
+            if p[2] in (self.platformTypeSand, self.platformTypeGrass, self.platformTypeWater):
+                self.screen.blit(
+                    self.imgPlatform[p[2]][p[4]],
+                    (p[0], p[1] - self.cameray)
+                )
+            elif p[2] == self.platformTypeBreaking:
+                self.screen.blit(
+                    self.imgPlatform[p[2]][1 if p[4] else 0],
+                    (p[0], p[1] - self.cameray)
+                )
             elif p[2] == self.platformTypeLucky:
-                if p[3]:
-                    self.screen.blit(self.imgPlatformLuckyAttacking, (p[0], p[1] - self.imgPlatformLuckyAttacking.get_height() + self.imgPlatformLuckySleeping.get_height() - self.cameray))
-                    if p[3] > 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:
+                if p[3] > 0:
+                    self.screen.blit(self.imgFlagRight, (p[0] + p[7] - 8, p[1] - 11 - self.cameray))
+                self.screen.blit(
+                    self.imgPlatform[p[2]][1 if p[3] else 0],
+                    (p[0], p[1] - self.platformLuckyAttackingHeight + p[8] - self.cameray) if p[3] else
+                    (p[0], p[1] - self.cameray)
+                )
+            else:
+                if p[2] == self.platformTypeAfterLucky and p[3]:
+                     self.screen.blit(self.imgFlagRight, (p[0] + 47, p[1] - 12 - self.cameray))
+                elif p[2] == self.platformTypeCastle and p[3]:
+                    self.screen.blit(self.imgFlagRight, (p[0] + p[7] - 16, p[1] - 4 - self.cameray))
+                elif p[3] == self.platformTypeRaftcastle and self.raftcastleHasFlag:
                     self.screen.blit(self.imgFlagRight, (p[0] + 50, p[1] - 13 - self.cameray))
-                self.screen.blit(self.imgPlatformRaftcastle, (p[0], p[1] - self.cameray))
-            elif p[2] == self.platformTypeBreaking:
-                if not p[4]:
-                    self.screen.blit(self.imgPlatformBreaking, (p[0], p[1] - self.cameray))
-                else:
-                    self.screen.blit(self.imgPlatformBroken, (p[0], p[1] - self.cameray))
-            elif p[2] == self.platformTypeTheEnd:
-                self.screen.blit(self.imgPlatformTheEnd, (p[0], p[1] - self.cameray))
-            elif p[2] == self.platformTypeWonTheGame:
-                self.screen.blit(self.imgPlatformWonTheGame, (p[0], p[1] - self.cameray))
+                self.screen.blit(
+                    self.imgPlatform[p[2]],
+                    (p[0], p[1] - self.cameray)
+                )
             if self.aiDebag:
                 self.screen.blit(self.font.render(str(p[2])+" "+str(p[5])+" "+str(p[6]), -1, (0, 0x57, 0xaf) if self.ai else (0xbb, 0x66, 0x22)), (p[0], p[1] - self.cameray + 16))
         if self.aiDebag: