More animation on result screen
This commit is contained in:
parent
c76ea8fe55
commit
28515f6b77
BIN
gamedata/assets/particles/sparkles/0.png
Normal file
BIN
gamedata/assets/particles/sparkles/0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 647 B |
BIN
gamedata/assets/particles/sparkles/1.png
Normal file
BIN
gamedata/assets/particles/sparkles/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 626 B |
BIN
gamedata/assets/particles/sparkles/2.png
Normal file
BIN
gamedata/assets/particles/sparkles/2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 588 B |
BIN
gamedata/assets/particles/sparkles/3.png
Normal file
BIN
gamedata/assets/particles/sparkles/3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 576 B |
BIN
gamedata/assets/particles/sparkles/4.png
Normal file
BIN
gamedata/assets/particles/sparkles/4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 570 B |
@ -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):
|
||||
|
@ -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)<past:
|
||||
# Make a noise
|
||||
txt = "Time : "+str(int(self.currenttime))
|
||||
txt += " ( "+str(self.game.globals["timetobeat"])+" for medal )"
|
||||
self.seconds = self.game.getchars(txt)
|
||||
if int(self.time)==int(self.currenttime) and int(self.game.globals["timetobeat"]) >= 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)
|
||||
|
Loading…
Reference in New Issue
Block a user