Compare commits

...

3 Commits

Author SHA1 Message Date
theo@manjaro 7bb10926a2 Bubbles when underwater 2021-11-28 15:17:15 +01:00
theo@manjaro 6543de826a Particle when player is hit 2021-11-28 14:58:34 +01:00
theo@manjaro 9504a8213c Harder clock medals 2021-11-28 14:55:38 +01:00
3 changed files with 15 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

View File

@ -1583,7 +1583,7 @@
{"x": 512, "y": 96},
{"x": 640, "y": 144}
],
"values": {"0": "Beginning;18", "1": "The Docks;18", "2": "Tiny Island;25", "3": "Archipelago;32", "4": "Shipping Bridges;25", "5": "Cityscape;25"}
"values": {"0": "Beginning;18", "1": "The Docks;18", "2": "Tiny Island;22", "3": "Archipelago;28", "4": "Shipping Bridges;23", "5": "Cityscape;25"}
},
{"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},
@ -1596,4 +1596,4 @@
]
}
]
}
}

View File

@ -17,6 +17,10 @@ class Player(Movable):
self.spritefalling = game.sprite_lib["player/falling.png"] # Descending
self.spritehurt = game.sprite_lib["player/hurt.png"] # Being hurted
self.spritelanding = game.sprite_lib["player/landing.png"]
self.ouch = game.getchars("Ouch !")
self.bubble = game.getSpriteDir("particles/bubble/")
self.bubbletimer = game.lib.Timer(0.3)
self.landingtimer = 0
self.maxlandtime = 0.15
self.spriteindex = 0
@ -212,6 +216,13 @@ class Player(Movable):
self.jumpsfx.play()
self.jumped = True
super().step() # Actually move
# Spawning bubbles
if self.water:
if self.rect.center[1]>self.water.rect.y and self.bubbletimer.tick((abs(self.horspd)+abs(self.verspd))/30):
offx = self.game.lib.randint(-8,8)
offy = self.game.lib.randint(-8,8)
self.game.addParticle(self.bubble,self.rect.center[0]+offx,self.rect.center[1]+offy,fps=2,depth=3,vely=-0.1)
if self.rect.center[1]>self.game.globals["cameray"]+self.game.globals["camerah"]:
self.die()
for i in self.spikes:
@ -298,6 +309,8 @@ class Player(Movable):
self.hp-=dmg
if self.hp<=0:
self.die()
else:
self.game.addParticle([self.ouch],self.rect.center[0],self.rect.center[1],fps=1,vely=-2,modvely=0.1) # "Ouch !" being displayed
def die(self):
if not self.dead: