From: Peter Gerwinski Date: Sat, 31 Mar 2018 20:06:53 +0000 (+0200) Subject: implemented Lucky X-Git-Url: http://bicyclesonthemoon.info/git-projects/?a=commitdiff_plain;h=77820dc05adcab0ef03253381fca556930ef29da;p=ott%2Fmolpy-up implemented Lucky --- diff --git a/assets/platformLuckyAttacking.png b/assets/platformLuckyAttacking.png new file mode 100644 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 index 0000000..17fb724 Binary files /dev/null and b/assets/platformLuckySleeping.png differ diff --git a/molpyup.py b/molpyup.py index bb98165..76a82d9 100644 --- a/molpyup.py +++ b/molpyup.py @@ -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))