Skip to content
Snippets Groups Projects
Commit 37dd3548 authored by Alan Aguiar's avatar Alan Aguiar
Browse files

remove spaces

parent 6f6b6e28
Branches graficas-componente
Tags
No related merge requests found
...@@ -14,12 +14,10 @@ def make_back(parent): ...@@ -14,12 +14,10 @@ def make_back(parent):
w = parent.game_w w = parent.game_w
h = parent.game_h h = parent.game_h
floor_y = parent.floor_y floor_y = parent.floor_y
back = pygame.surface.Surface((w, h), 0) back = pygame.surface.Surface((w, h), 0)
back.fill(SKY) back.fill(SKY)
rect = pygame.rect.Rect(0, floor_y, w, h - floor_y) rect = pygame.rect.Rect(0, floor_y, w, h - floor_y)
back.fill(GROUND, rect) back.fill(GROUND, rect)
if w > 684: if w > 684:
t = int(math.ceil(w / 684.0)) t = int(math.ceil(w / 684.0))
else: else:
......
...@@ -14,9 +14,7 @@ class Bird(pygame.sprite.Sprite): ...@@ -14,9 +14,7 @@ class Bird(pygame.sprite.Sprite):
def __init__(self, parent, x=0, y=0): def __init__(self, parent, x=0, y=0):
pygame.sprite.Sprite.__init__(self) pygame.sprite.Sprite.__init__(self)
self.parent = parent self.parent = parent
self.mPos = [x, y] self.mPos = [x, y]
self.mVel = 0 self.mVel = 0
self.mAcc = 5 self.mAcc = 5
......
...@@ -64,6 +64,7 @@ class Flappy(): ...@@ -64,6 +64,7 @@ class Flappy():
self.mes_y = (self.game_h - MES_H) / 2 self.mes_y = (self.game_h - MES_H) / 2
self.game_p = self.game_w - DIST - self.pipe_w self.game_p = self.game_w - DIST - self.pipe_w
self.max_s = self.floor_y - MIN_PIPE_H - DIST self.max_s = self.floor_y - MIN_PIPE_H - DIST
self.min_pipe_h = MIN_PIPE_H
self.end_s_x = (self.game_w - 139) / 2 self.end_s_x = (self.game_w - 139) / 2
self.sc_x = (self.game_w - 70) / 2 self.sc_x = (self.game_w - 70) / 2
......
...@@ -10,22 +10,19 @@ body = pygame.image.load('images/pipe.png') ...@@ -10,22 +10,19 @@ body = pygame.image.load('images/pipe.png')
class Pipe_I(pygame.sprite.Sprite): class Pipe_I(pygame.sprite.Sprite):
def __init__(self, parent, x=0, height=82): def __init__(self, parent, x, height):
pygame.sprite.Sprite.__init__(self) pygame.sprite.Sprite.__init__(self)
self.flag = True self.flag = True
self.points = True self.points = True
self.parent = parent self.parent = parent
self.mPos = [x, 500] self.mPos = [x, 500]
self.mVel = -5 self.mVel = -5
if height < 82:
height = 82
h = height - 42 h = height - 42
self.p = h / 40 self.p = h / 40
self.height = self.p * 40 + 42 self.height = self.p * 40 + 42
self.mPos[1] = self.parent.floor_y - self.height self.mPos[1] = self.parent.floor_y - self.height
self.image = pygame.surface.Surface((91, self.height), 0) self.image = pygame.surface.Surface((91, self.height), 0)
self.image.fill((255, 255, 255)) self.image.fill((255, 255, 255))
self.image.blit(head, (0, 0)) self.image.blit(head, (0, 0))
for i in range(self.p): for i in range(self.p):
self.image.blit(body, (4, 42 + i * 40)) self.image.blit(body, (4, 42 + i * 40))
...@@ -51,7 +48,7 @@ class Pipe_I(pygame.sprite.Sprite): ...@@ -51,7 +48,7 @@ class Pipe_I(pygame.sprite.Sprite):
elif self.mPos[0] < (self.parent.game_p): elif self.mPos[0] < (self.parent.game_p):
if self.flag: if self.flag:
self.flag = False self.flag = False
h = random.randrange(82, self.parent.max_s) h = random.randrange(self.parent.min_pipe_h, self.parent.max_s)
p = Pipe_I(self.parent, self.parent.game_w, h) p = Pipe_I(self.parent, self.parent.game_w, h)
self.parent.sprites.add(p, layer=1) self.parent.sprites.add(p, layer=1)
self.parent.tubes.add(p) self.parent.tubes.add(p)
...@@ -74,7 +71,6 @@ class Pipe_S(pygame.sprite.Sprite): ...@@ -74,7 +71,6 @@ class Pipe_S(pygame.sprite.Sprite):
self.p = h / 40 self.p = h / 40
self.height = self.p * 40 + 42 self.height = self.p * 40 + 42
if self.height > height: if self.height > height:
print 'truee'
dx = self.height - height dx = self.height - height
self.mPos[1] = -dx self.mPos[1] = -dx
self.image = pygame.surface.Surface((91, self.height), 0) self.image = pygame.surface.Surface((91, self.height), 0)
......
...@@ -75,6 +75,3 @@ class Message(pygame.sprite.Sprite): ...@@ -75,6 +75,3 @@ class Message(pygame.sprite.Sprite):
self.rect.x = self.mPos[0] self.rect.x = self.mPos[0]
self.rect.y = self.mPos[1] self.rect.y = self.mPos[1]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment