Bubbles when underwater
This commit is contained in:
parent
6543de826a
commit
7bb10926a2
BIN
gamedata/assets/particles/bubble/0.png
Normal file
BIN
gamedata/assets/particles/bubble/0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 618 B |
@ -19,6 +19,8 @@ class Player(Movable):
|
|||||||
self.spritelanding = game.sprite_lib["player/landing.png"]
|
self.spritelanding = game.sprite_lib["player/landing.png"]
|
||||||
|
|
||||||
self.ouch = game.getchars("Ouch !")
|
self.ouch = game.getchars("Ouch !")
|
||||||
|
self.bubble = game.getSpriteDir("particles/bubble/")
|
||||||
|
self.bubbletimer = game.lib.Timer(0.3)
|
||||||
self.landingtimer = 0
|
self.landingtimer = 0
|
||||||
self.maxlandtime = 0.15
|
self.maxlandtime = 0.15
|
||||||
self.spriteindex = 0
|
self.spriteindex = 0
|
||||||
@ -214,6 +216,13 @@ class Player(Movable):
|
|||||||
self.jumpsfx.play()
|
self.jumpsfx.play()
|
||||||
self.jumped = True
|
self.jumped = True
|
||||||
super().step() # Actually move
|
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"]:
|
if self.rect.center[1]>self.game.globals["cameray"]+self.game.globals["camerah"]:
|
||||||
self.die()
|
self.die()
|
||||||
for i in self.spikes:
|
for i in self.spikes:
|
||||||
|
Loading…
Reference in New Issue
Block a user