Added score et lives display
This commit is contained in:
parent
0edc8cb3ac
commit
1194ccfd55
@ -12,7 +12,10 @@ class BaseObject():
|
|||||||
def step(self):
|
def step(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def draw(self):
|
def draw(self): # Drawed on the surface with camera adjustement
|
||||||
if self.sprite:
|
if self.sprite:
|
||||||
self.game.window.blit(self.sprite,self.rect[:2])
|
self.game.window.blit(self.sprite,self.rect[:2])
|
||||||
|
|
||||||
|
def afterdraw(self): # Drawed on the surface after camera adjustement, must draw on game.realwindow
|
||||||
|
pass
|
||||||
|
|
||||||
|
@ -66,3 +66,5 @@ class GameLoop():
|
|||||||
game.globals["tempsubsurface"].blit(game.window,[0,0])
|
game.globals["tempsubsurface"].blit(game.window,[0,0])
|
||||||
temp = game.pygame.transform.scale(game.globals["tempsubsurface"],(game.DISPLAY_WIDTH,game.DISPLAY_HEIGHT))
|
temp = game.pygame.transform.scale(game.globals["tempsubsurface"],(game.DISPLAY_WIDTH,game.DISPLAY_HEIGHT))
|
||||||
game.realwindow.blit(temp,[0,0])
|
game.realwindow.blit(temp,[0,0])
|
||||||
|
for i in values:
|
||||||
|
i.afterdraw() # Draw on the "real screen"
|
||||||
|
@ -38,7 +38,6 @@ class Manager(BaseObject):
|
|||||||
if self.invincible:
|
if self.invincible:
|
||||||
if self.deathtimer.tick(self.game.dt):
|
if self.deathtimer.tick(self.game.dt):
|
||||||
self.invincible = False
|
self.invincible = False
|
||||||
print(self.lives)
|
|
||||||
|
|
||||||
def death(self):
|
def death(self):
|
||||||
if not self.invincible:
|
if not self.invincible:
|
||||||
@ -48,3 +47,9 @@ class Manager(BaseObject):
|
|||||||
def draw(self):
|
def draw(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def afterdraw(self):
|
||||||
|
txtsurfacescore = self.game.fontfile.render("Score : "+str(int(self.score)),False,[150,255,150])
|
||||||
|
txtsurfacelives = self.game.fontfile.render("Lives : "+str(int(self.lives)),False,[255,150,150])
|
||||||
|
self.game.realwindow.blit(txtsurfacescore,[20,20])
|
||||||
|
self.game.realwindow.blit(txtsurfacelives,[20,20*2+txtsurfacescore.get_height()])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user