diff --git a/gamedata/assets/particles/sparkles/0.png b/gamedata/assets/particles/sparkles/0.png new file mode 100644 index 0000000..f6796bc Binary files /dev/null and b/gamedata/assets/particles/sparkles/0.png differ diff --git a/gamedata/assets/particles/sparkles/1.png b/gamedata/assets/particles/sparkles/1.png new file mode 100644 index 0000000..f3be9fd Binary files /dev/null and b/gamedata/assets/particles/sparkles/1.png differ diff --git a/gamedata/assets/particles/sparkles/2.png b/gamedata/assets/particles/sparkles/2.png new file mode 100644 index 0000000..4a8b250 Binary files /dev/null and b/gamedata/assets/particles/sparkles/2.png differ diff --git a/gamedata/assets/particles/sparkles/3.png b/gamedata/assets/particles/sparkles/3.png new file mode 100644 index 0000000..e7daf05 Binary files /dev/null and b/gamedata/assets/particles/sparkles/3.png differ diff --git a/gamedata/assets/particles/sparkles/4.png b/gamedata/assets/particles/sparkles/4.png new file mode 100644 index 0000000..fe9b705 Binary files /dev/null and b/gamedata/assets/particles/sparkles/4.png differ diff --git a/gamedata/game.py b/gamedata/game.py index 9747358..2b04d55 100644 --- a/gamedata/game.py +++ b/gamedata/game.py @@ -278,8 +278,9 @@ class Game(): return sprite_list - def addParticle(self,sprites,posx,posy,velx=0,vely=0,modvelx=0,modvely=0,flipx=False,flipy=False,fps=15): + def addParticle(self,sprites,posx,posy,velx=0,vely=0,modvelx=0,modvely=0,flipx=False,flipy=False,fps=15,depth=0): p = Particle(self,sprites,posx,posy,velx,vely,modvelx,modvely,flipx,flipy,fps) + p.depth = depth self.gameloop.summon(p) def scaleCamera(self,neww=None,newh=None): diff --git a/gamedata/objects/results.py b/gamedata/objects/results.py index 907a92d..557f0ab 100644 --- a/gamedata/objects/results.py +++ b/gamedata/objects/results.py @@ -10,10 +10,17 @@ class Results(BaseObject): self.maxcount = self.game.globals["totaltrashes"] self.currentcount = 0 self.count = self.game.globals["trashes"] + + self.maxtime = self.game.globals["timetobeat"] + self.currenttime = 99 + self.time = min(99,self.game.globals["timer"]) + + self.sparkles = game.getSpriteDir("particles/dust/") + self.text = self.game.getchars("Cleared : 0 / "+str(self.maxcount)) self.levelname = self.game.getchars("Level "+str(self.game.globals["levelname"]+1)) self.levellore = None - txt = "Time : "+str(int(self.game.globals["timer"])) + txt = "Time : 0" txt += " ( "+str(self.game.globals["timetobeat"])+" for medal )" self.seconds = self.game.getchars(txt) if self.game.globals["levellore"]: @@ -29,10 +36,15 @@ class Results(BaseObject): self.medalwave = self.game.sprite_lib["medals/wave.png"] self.medalclock= self.game.sprite_lib["medals/clock.png"] + self.medalwaveoff = self.game.sprite_lib["medals/waveoff.png"] + self.medalclockoff = self.game.sprite_lib["medals/clockoff.png"] self.transition = False self.depth = 3 + + self.centerx = self.game.globals["cameraw"]/2 + self.centery = self.game.globals["camerah"]/2 def step(self): @@ -44,6 +56,21 @@ class Results(BaseObject): if int(self.currentcount)>past: # Make a noise self.text = self.game.getchars("Cleared : "+str(int(self.currentcount))+" / "+str(self.maxcount)) + if self.currentcount == self.maxcount: # Spawn sparkles + self.game.addParticle(self.sparkles,self.centerx+150+self.game.globals["camerax"],self.centery+self.game.globals["cameray"],fps=6,depth=4) + + past = int(self.currenttime) + self.currenttime-=self.game.dt + self.currenttime+= (self.time- self.currenttime)*self.game.dt + self.currenttime= max(self.currenttime,self.time) + + if int(self.currenttime)= int(self.currenttime): # Spawn sparkles + self.game.addParticle(self.sparkles,self.centerx+150+self.game.globals["camerax"],self.centery+20+self.game.globals["cameray"],fps=6,depth = 4) if not self.transition: keys = ["up","down","left","right"] @@ -63,8 +90,8 @@ class Results(BaseObject): def draw(self): self.fill.set_alpha(self.alpha) self.game.window.blit(self.fill,[0,0]) - cx = self.game.globals["cameraw"]/2 - cy = self.game.globals["camerah"]/2 + + cx,cy = self.centerx,self.centery self.game.lib.drawcenter(self.game,self.levelname,cx,cy-50) # Level names if self.levellore: @@ -72,7 +99,11 @@ class Results(BaseObject): self.game.lib.drawcenter(self.game,self.text,cx,cy) # Clean self.game.lib.drawcenter(self.game,self.seconds,cx,cy+20) + medal = self.medalwaveoff if self.currentcount == self.maxcount: # Medals - self.game.lib.drawcenter(self.game,self.medalwave,cx+150,cy) - if int(self.game.globals["timetobeat"]) >= int(self.game.globals["timer"]): - self.game.lib.drawcenter(self.game,self.medalclock,cx+150,cy+20) + medal = self.medalwave + self.game.lib.drawcenter(self.game,medal,cx+150,cy) + medal = self.medalclockoff + if int(self.time)==int(self.currenttime) and int(self.game.globals["timetobeat"]) >= int(self.currenttime): + medal = self.medalclock + self.game.lib.drawcenter(self.game,medal,cx+150,cy+20)