From 12fe9baf14a46692fc204fa0c47cb084468365ba Mon Sep 17 00:00:00 2001 From: Jorge Adrian Saghin Dudulea <39440777+Z4na14@users.noreply.github.com> Date: Tue, 12 Dec 2023 14:58:53 +0100 Subject: [PATCH] game almost finished --- resources/texture.pyxres | Bin 14418 -> 14417 bytes src/coins.py | 2 +- src/enemies.py | 30 +++++++++++++++++++----------- src/main.py | 27 +++++++++++++++------------ src/player.py | 11 +++++++---- topscore.json | 2 +- 6 files changed, 43 insertions(+), 29 deletions(-) diff --git a/resources/texture.pyxres b/resources/texture.pyxres index b475d687edb03413f9ca08b0f43633d4ff743a08..91062adacd2777e41a6db02b4e1d0b807fb2be48 100644 GIT binary patch delta 245 zcmcaqaIs*+Sxq*pjaA0!%##ar73vM&-Z9KNY#`zAFn0OG>D#`qtp2YZ!Wn1G^2p-D zKK_4aBPPo`v7O}%>E%q}WN7LAxx4mmdVKM&t;foE3U)>_?0dg?z2)7gWNWq^cXS!- zzu&w*CvWXWS>~9$HT{M4H*G$h*?i!(1xt$oV*?y*c>bTs=F_V04Ef3ICJc#8Na*pE z$#wON4;J5KbeO^5Fhjag;Y_cCz%w@m4(ZSNxyRQ_JSgI0RNQ<~tAlCs11&A)oHO;C hV|3HFSiwG;eB3;WDOz{(J#&f4))sd=f{#Blhx z-OKxnDjuCQI+V;1dYWMq3&WvlA9vTi-F(*aZcMT*+m5@+4EKNM6#JQ9kLYL2`_6IT zyxr|Nm(QABOK!NW`#JHBozeNYzqSRI?F|BI3<&h?UUWnH{2%-eipm&F5yC(v+xFB% z)nD7reBkLD1_d7mg)_Yl0?*tOIEs}8T67=h=N*49@t};4QE~G@t?5jYFK9_K=ScqF g9Iczi#R~S) 3: + if (float(self.parsedtime) - float(i.timeDed)) > 3.0: return True # If the enemy is not dead continue with the check @@ -299,7 +302,7 @@ def enemiesCheck(self, i): if (self.mario.kickPos[1] - 13) <= i.posY <= (self.mario.kickPos[1] - 5): if self.mario.kickPos[0] - 5 <= (i.posX + i.collideX // 2) <= \ (self.mario.kickPos[0] + 16): - i.kickFall("turn", self.parsedtime) + i.kickFall("turn", self.timesKickedPlatforms, self.parsedtime) # Check if mario is in the range of an enemy if self.mario is not None and self.mario.checkEnemy(i.posX, i.posY, i.collideX, i.collideY): @@ -379,12 +382,12 @@ def changeLv(self): levels.Platform(0, 192, 240, 8)], [[8, 24], [220, 24], [0, 180], [240, 180]]) -screen2 = levels.Screen(2, [levels.Platform(2, 48, 140, 8), - levels.Platform(178, 48, 60, 8), - levels.Platform(2, 96, 100, 8), - levels.Platform(138, 96, 100, 8), - levels.Platform(2, 144, 60, 8), - levels.Platform(98, 144, 140, 8), +screen2 = levels.Screen(2, [levels.Platform(2, 48, 148, 8), + levels.Platform(202, 48, 36, 8), + levels.Platform(2, 96, 92, 8), + levels.Platform(146, 96, 92, 8), + levels.Platform(2, 144, 36, 8), + levels.Platform(90, 144, 148, 8), levels.Platform(0, 192, 240, 8)], [[8, 24], [220, 24], [0, 180], [240, 180]]) diff --git a/src/player.py b/src/player.py index 949f3ea..acf20a3 100644 --- a/src/player.py +++ b/src/player.py @@ -83,8 +83,10 @@ def checkMovement(self, dimX, currplatforms, time): if self.isDed: if float(time) - float(self.timeDed) >= 3: self.isDed = False + self.isFalling = False + self.velY = 6 self.posX = 110 - self.posY = 170 + self.posY = 20 else: @@ -220,9 +222,10 @@ def checkIsParallel(self, currplatforms): # Used to check whether Mario is in the range of the enemy def checkEnemy(self, posXenemy, posYenemy, collideXenemy, collideYenemy): - if posYenemy <= self.posY + self.collideY <= (posYenemy + collideYenemy): - if posXenemy <= self.posX <= (posXenemy + collideXenemy) or posXenemy <= \ - (self.posX + self.collideX) <= (posXenemy + collideXenemy): + if posYenemy <= self.posY + self.collideY <= (posYenemy + collideYenemy) or \ + posYenemy <= self.posY <= (posYenemy + collideYenemy): + if posXenemy <= self.posX <= (posXenemy + collideXenemy) or \ + posXenemy <= (self.posX + self.collideX) <= (posXenemy + collideXenemy): return True # Function to execute when Mario die diff --git a/topscore.json b/topscore.json index 28ab4ce..a84a3d8 100644 --- a/topscore.json +++ b/topscore.json @@ -1,3 +1,3 @@ { - "topscore": 2100 + "topscore": 33 } \ No newline at end of file