Added second level

This commit is contained in:
theo@manjaro 2021-11-24 19:59:23 +01:00
parent c6a32a6b65
commit 4517c6d877
7 changed files with 5713 additions and 2065 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 33 KiB

File diff suppressed because it is too large Load Diff

View File

@ -1583,7 +1583,7 @@
{"x": 512, "y": 96},
{"x": 640, "y": 144}
],
"values": {"0": "Beginning;20", "1": "The Docks;40"}
"values": {"0": "Beginning;18", "1": "The Docks;18"}
},
{"name": "Ripple", "id": 1, "_eid": "76589705", "x": 368, "y": 192, "originX": 0, "originY": 0},
{"name": "Ripple", "id": 2, "_eid": "76589705", "x": 224, "y": 176, "originX": 0, "originY": 0},

View File

@ -8,6 +8,8 @@ class Ennemy(Movable):
self.player = None
self.damage = 1
self.respawnmargin = 30
self.respawn = True
@ -43,7 +45,7 @@ class Ennemy(Movable):
hor = 1
else:
hor = -1
self.player.yeet(hor*6,self.player.gravityway*-3)
self.player.yeet(hor*6,self.player.gravityway*-3,dmg=self.damage)
if self.candie and self.player.canhit:
if self.rect.colliderect(self.player.hitrect):
# Die

View File

@ -25,6 +25,7 @@ class Player(Movable):
self.hp = 2
self.dead = False
self.spikes = self.tileset.spikes
self.deathtimer = self.game.lib.Timer(0.5)
self.deadsfx = self.game.sound_lib["sfx/dead.wav"]
self.retrytext = self.game.getchars("Try again !")
@ -219,8 +220,9 @@ class Player(Movable):
super().step() # Actually move
if self.rect.center[1]>self.game.globals["cameray"]+self.game.globals["camerah"]:
self.die()
self.game.globals["scamerax"] = 4
self.game.globals["scameray"] = 4
for i in self.spikes:
if i.collidepoint(self.rect.center):
self.die()
# Updated hitrect
self.hitrect[0] = self.rect.center[0]-self.hitrect[2]/2
offset = 0
@ -288,7 +290,7 @@ class Player(Movable):
self.combo+=1
self.combotimer = 1
def yeet(self,hor,ver,resetcombo=True):
def yeet(self,hor,ver,resetcombo=True,dmg = 1):
if not self.dead:
self.verspd = 0
self.horkb = hor
@ -299,12 +301,14 @@ class Player(Movable):
self.game.globals["scameray"] = 4
self.combo = 0
self.hurtsfx.play()
self.hp-=1
self.hp-=dmg
if self.hp<=0:
self.die()
def die(self):
if not self.dead:
self.game.globals["scamerax"] = 4
self.game.globals["scameray"] = 4
self.deadsfx.play()
self.depth = 5
self.rect[2],self.rect[3] = 0,0

View File

@ -75,6 +75,7 @@ class TilesetRenderer(BaseObject):
name = level["name"]
self.rects = []
self.semirects = []
self.spikes = []
self.layers = []
self.spawns = []
spawnlists = {"Spawns":self.spawns}
@ -142,7 +143,7 @@ class TilesetRenderer(BaseObject):
w = entity["width"]
if "height" in entity.keys():
h = entity["height"]
lists = {"Solid":self.rects,"SemiSolid":self.semirects}
lists = {"Solid":self.rects,"SemiSolid":self.semirects,"Spikes":self.spikes}
lists[entity["name"]].append(self.game.pygame.Rect(x,y,w,h))
except:
self.game.log("Erreur",name,entity,"Propriétés invalides")