Combo counter
This commit is contained in:
parent
3d7be44d82
commit
a149933b28
BIN
gamedata/assets/player/combo/0.png
Normal file
BIN
gamedata/assets/player/combo/0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 625 B |
BIN
gamedata/assets/player/combo/1.png
Normal file
BIN
gamedata/assets/player/combo/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 635 B |
BIN
gamedata/assets/player/combo/2.png
Normal file
BIN
gamedata/assets/player/combo/2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 635 B |
BIN
gamedata/assets/player/combo/3.png
Normal file
BIN
gamedata/assets/player/combo/3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 638 B |
BIN
gamedata/assets/player/combo/4.png
Normal file
BIN
gamedata/assets/player/combo/4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 639 B |
@ -17,6 +17,8 @@ class Ennemy(Movable):
|
|||||||
self.particleoffsety = 0
|
self.particleoffsety = 0
|
||||||
|
|
||||||
self.canhit = True
|
self.canhit = True
|
||||||
|
self.candie = True
|
||||||
|
self.cancombo = True
|
||||||
|
|
||||||
self.dustparticles = game.getSpriteDir("particles/dust/")
|
self.dustparticles = game.getSpriteDir("particles/dust/")
|
||||||
|
|
||||||
@ -37,7 +39,8 @@ class Ennemy(Movable):
|
|||||||
hor = -1
|
hor = -1
|
||||||
self.player.horkb = hor*6
|
self.player.horkb = hor*6
|
||||||
self.player.verkb = self.player.gravityway*-3
|
self.player.verkb = self.player.gravityway*-3
|
||||||
if self.player.canhit:
|
self.player.combo = 0
|
||||||
|
if self.candie and self.player.canhit:
|
||||||
if self.rect.colliderect(self.player.hitrect):
|
if self.rect.colliderect(self.player.hitrect):
|
||||||
# Die
|
# Die
|
||||||
self.dead = True
|
self.dead = True
|
||||||
@ -51,6 +54,7 @@ class Ennemy(Movable):
|
|||||||
else:
|
else:
|
||||||
direction = -1
|
direction = -1
|
||||||
self.player.verspd = self.player.gravity/3*direction
|
self.player.verspd = self.player.gravity/3*direction
|
||||||
|
self.player.upcombo()
|
||||||
elif self.respawn:
|
elif self.respawn:
|
||||||
|
|
||||||
if self.rect.center[0] < self.game.globals["camerax"]-self.respawnmargin:
|
if self.rect.center[0] < self.game.globals["camerax"]-self.respawnmargin:
|
||||||
|
@ -78,12 +78,12 @@ class Movable(BaseObject):
|
|||||||
result = False
|
result = False
|
||||||
if classic:
|
if classic:
|
||||||
for rect in self.collisionrects:
|
for rect in self.collisionrects:
|
||||||
if temprect.colliderect(rect):
|
if rect!=self.rect and temprect.colliderect(rect):
|
||||||
result = rect
|
result = rect
|
||||||
break
|
break
|
||||||
if not result and semi:
|
if not result and semi:
|
||||||
for rect in self.semirects:
|
for rect in self.semirects:
|
||||||
if self.rect.bottom<=rect.top:
|
if rect!=self.rect and self.rect.bottom<=rect.top:
|
||||||
if temprect.colliderect(rect):
|
if temprect.colliderect(rect):
|
||||||
result = rect
|
result = rect
|
||||||
break
|
break
|
||||||
|
@ -69,6 +69,9 @@ class Player(Movable):
|
|||||||
self.leapmargin = 30 # Vertical margin for the leap
|
self.leapmargin = 30 # Vertical margin for the leap
|
||||||
self.gravityway = 1
|
self.gravityway = 1
|
||||||
|
|
||||||
|
self.combo = 0
|
||||||
|
self.combosprites = self.game.getSpriteDir("player/combo/")
|
||||||
|
|
||||||
def step(self):
|
def step(self):
|
||||||
|
|
||||||
if not self.hitpose:
|
if not self.hitpose:
|
||||||
@ -128,6 +131,7 @@ class Player(Movable):
|
|||||||
self.fastfall = 0
|
self.fastfall = 0
|
||||||
if self.checkcollisions(0,self.gravityway):
|
if self.checkcollisions(0,self.gravityway):
|
||||||
self.onground = True
|
self.onground = True
|
||||||
|
self.combo = 0
|
||||||
self.leaptimer = self.leapmaxtimer
|
self.leaptimer = self.leapmaxtimer
|
||||||
self.candash = True
|
self.candash = True
|
||||||
self.canfastfall = True
|
self.canfastfall = True
|
||||||
@ -226,6 +230,15 @@ class Player(Movable):
|
|||||||
self.game.globals["camerax"] = self.rect.center[0]-self.game.globals["cameraw"]/2
|
self.game.globals["camerax"] = self.rect.center[0]-self.game.globals["cameraw"]/2
|
||||||
self.game.globals["cameray"] = self.rect.center[1]-self.game.globals["camerah"]/2
|
self.game.globals["cameray"] = self.rect.center[1]-self.game.globals["camerah"]/2
|
||||||
|
|
||||||
|
def upcombo(self):
|
||||||
|
|
||||||
|
# Up the combo and spawn particles
|
||||||
|
if self.combo>=1:
|
||||||
|
index = min(self.combo-1,len(self.combosprites)-1)
|
||||||
|
self.game.addParticle([self.combosprites[index]],self.rect.center[0],self.rect.top,fps=1)
|
||||||
|
|
||||||
|
self.combo+=1
|
||||||
|
|
||||||
def draw(self):
|
def draw(self):
|
||||||
flipy = (self.gravityway<0 and not self.leaptimer<0)
|
flipy = (self.gravityway<0 and not self.leaptimer<0)
|
||||||
if self.fastfall:
|
if self.fastfall:
|
||||||
|
Loading…
Reference in New Issue
Block a user