Example #1
0
    def __init__(self, bird_imgs, loop=True, frames=1, angle=0):
        # select and create bird image
        x = random.randint(0, 2)
        self.image_list = []
        self.image_list.append(bird_imgs[0 + (x * 3)])
        self.image_list.append(bird_imgs[1 + (x * 3)])
        self.image_list.append(bird_imgs[2 + (x * 3)])
        self.img = self.image_list[0]

        # positional variables
        self.posx = (WINDOWWIDTH / 2) - (BIRDSIZE / 2)
        self.posy = 256.0
        self.dy = 0.00
        self.right = self.posx + BIRDSIZE
        self.center = self.posx + (BIRDSIZE / 2)

        # animation variables
        self.i = 0
        self.f = frames
        self.loop = True
        self.frames = frames

        # angle variables
        self.angle = angle
        self.dt_angle = -0.1

        # hover variables
        self.boundary_upper = self.posy + int(scaletoheight(5.0))
        self.boundary_lower = self.posy + int(scaletoheight(10.0))
        self.hover_dy = 1.0
        self.hover_dy2 = 0.05
Example #2
0
  def __init__(self, bird_imgs, loop=True, frames=1, angle=0):
    # select and create bird image
    x = random.randint(0,2)
    self.image_list = []
    self.image_list.append(bird_imgs[0+(x*3)])
    self.image_list.append(bird_imgs[1+(x*3)])
    self.image_list.append(bird_imgs[2+(x*3)])
    self.img = self.image_list[0]

    # positional variables
    self.posx = (WINDOWWIDTH / 2) - (BIRDSIZE / 2)
    self.posy = 256.0
    self.dy = 0.00
    self.right = self.posx + BIRDSIZE
    self.center = self.posx + (BIRDSIZE/2)

    # animation variables
    self.i = 0
    self.f = frames
    self.loop = True
    self.frames = frames
    
    # angle variables
    self.angle = angle
    self.dt_angle = -0.1
    
    # hover variables
    self.boundary_upper = self.posy + int(scaletoheight(5.0))
    self.boundary_lower = self.posy + int(scaletoheight(10.0))
    self.hover_dy = 1.0
    self.hover_dy2 = 0.05
Example #3
0
    def update(self, gamePoints, highScore, newScore=False):
        gameScoreWhite = displayText(str(gamePoints),
                                     scaletowidth(75.0),
                                     scaletoheight(55.0),
                                     color=WHITE)
        gameScoreBlack = displayText(str(gamePoints),
                                     scaletowidth(75.0),
                                     scaletoheight(55.0),
                                     color=BLACK)
        gameScoreBlack[1].right += scaletowidth(3)
        gameScoreBlack[1].top += scaletoheight(3)
        self.img.blit(gameScoreBlack[0], gameScoreBlack[1])
        self.img.blit(gameScoreWhite[0], gameScoreWhite[1])

        highScoreWhite = displayText(str(highScore),
                                     scaletowidth(190.0),
                                     scaletoheight(55.0),
                                     color=WHITE)
        highScoreBlack = displayText(str(highScore),
                                     scaletowidth(190.0),
                                     scaletoheight(55.0),
                                     color=BLACK)
        highScoreBlack[1].right += scaletowidth(3)
        highScoreBlack[1].top += scaletoheight(3)
        self.img.blit(highScoreBlack[0], highScoreBlack[1])
        self.img.blit(highScoreWhite[0], highScoreWhite[1])

        if newScore:
            self.img.blit(self.newscoreimg,
                          (scaletowidth(200), scaletoheight(10)))
Example #4
0
  def update(self,gamePoints,highScore,newScore=False):
    gameScoreWhite = displayText(str(gamePoints), scaletowidth(75.0), scaletoheight(55.0), color=WHITE)
    gameScoreBlack = displayText(str(gamePoints), scaletowidth(75.0), scaletoheight(55.0), color=BLACK)
    gameScoreBlack[1].right += scaletowidth(3)
    gameScoreBlack[1].top += scaletoheight(3)
    self.img.blit(gameScoreBlack[0], gameScoreBlack[1])
    self.img.blit(gameScoreWhite[0], gameScoreWhite[1])

    highScoreWhite = displayText(str(highScore), scaletowidth(190.0), scaletoheight(55.0), color=WHITE)
    highScoreBlack = displayText(str(highScore), scaletowidth(190.0), scaletoheight(55.0), color=BLACK)
    highScoreBlack[1].right += scaletowidth(3)
    highScoreBlack[1].top += scaletoheight(3)
    self.img.blit(highScoreBlack[0], highScoreBlack[1])
    self.img.blit(highScoreWhite[0], highScoreWhite[1])

    if newScore: self.img.blit(self.newscoreimg, (scaletowidth(200),scaletoheight(10)))
Example #5
0
 def __init__(self, titleImg, startingx):
     self.rect = pygame.Rect(WINDOWWIDTH / 2 - titleImg.get_size()[0] / 2,
                             int(scaletoheight(144.0)),
                             titleImg.get_size()[0],
                             titleImg.get_size()[1])
     self.img = titleImg
Example #6
0
 def __init__(self, titleImg, startingx):
   self.rect = pygame.Rect(WINDOWWIDTH/2 - titleImg.get_size()[0]/2,  int(scaletoheight(144.0)), titleImg.get_size()[0], titleImg.get_size()[1])
   self.img = titleImg