Exemple #1
0
        elif event.type == KEYUP:
            if event.key == K_UP:
                up = False

    screen.blit(background, (0, 0))

    if (not dead):
        player.move(player_speed, up=up)

    player.render(screen, not up)

    for pipe in pipes:
        x, y = player.get_pos()
        x1, y1 = pipe.get_pos()

        if (player.get_collision(pipe)):
            die()

        elif (x > x1 and x < x1 + pipe.get_width() and timer > 40):
            score += 1
            timer = 0

        elif (x > x1 and x < x1 + pipe.get_width() and timer <= 40):
            timer += 1

        if (not dead):
            pipe.move(pipes_speed, left=True)

        pipe.render(screen)

    if (dead):
Exemple #2
0
                up = False


    screen.blit(background, (0,0) )

    if (not dead):
        player.move(player_speed, up = up)
    
    player.render(screen, not up)


    for pipe in pipes:
        x, y = player.get_pos()
        x1,y1= pipe.get_pos()
        
        if (player.get_collision(pipe)):
            die()

        elif (x > x1 and x < x1+pipe.get_width() and timer > 40):
            score += 1
            timer = 0

        elif (x > x1 and x < x1+pipe.get_width() and timer <= 40):
            timer += 1
            
        if (not dead):
            pipe.move(pipes_speed, left = True)

        pipe.render(screen)

    if (dead):