Commit 1d2ba343 authored by Alan Aguiar's avatar Alan Aguiar
Browse files

use layer parameter to avoid problems

parent dd03786f
......@@ -75,21 +75,21 @@ class Flappy():
self.message = Message(200, 200)
self.currentS = CurrentScore(300, 100)
########################################################################
self.sprites.add(self.build)
self.sprites.add(self.floor)
self.sprites.add(self.bird)
self.sprites.add(self.message)
self.sprites.add(self.build, layer=0)
self.sprites.add(self.floor, layer=0)
self.sprites.add(self.bird, layer=2)
self.sprites.add(self.message, layer=3)
def load_game(self):
pipe1 = Pipe_I(self, self.game_w, 122)
pipe2 = Pipe_S(self, self.game_w, GAME_SIZE[1] - 122 - 160)
self.sprites.add(pipe1)
self.sprites.add(pipe2)
self.sprites.add(pipe1, layer=1)
self.sprites.add(pipe2, layer=1)
self.tubes.add(pipe1)
self.tubes.add(pipe2)
self.tubes.add(self.floor)
self.sprites.add(self.currentS)
self.sprites.add(self.currentS, layer=3)
self.bird.mAcc = 5
self.bird.count = 20
self.floor.mVel = -5
......@@ -148,7 +148,7 @@ class Flappy():
self.floor.mVel = 0
for spr in self.tubes:
spr.mVel = 0
self.sprites.add(self.scores)
self.sprites.add(self.scores, layer=3)
self.sprites.draw(self.screen)
self.running_t = True
while self.running_t:
......
......@@ -54,12 +54,12 @@ class Pipe_I(pygame.sprite.Sprite):
h = random.randrange(82, self.parent.max_s)
p = Pipe_I(self.parent, self.parent.game_w, h)
self.parent.sprites.add(p)
self.parent.sprites.add(p, layer=1)
self.parent.tubes.add(p)
s = p.mPos[1] + p.height + 160
s = self.parent.game_h - p.height - 160 - 50
p = Pipe_S(self.parent, self.parent.game_w, s)
self.parent.sprites.add(p)
self.parent.sprites.add(p, layer=1)
self.parent.tubes.add(p)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment