コード例 #1
0
ファイル: run_game.py プロジェクト: benoxoft/mti880handcopter
def show_message(msg):
    draw(0)
    font = media.get_font(44)
    s = font.render(msg, True, (255,255,255))
    screen.blit(s, (300 - s.get_width() / 2, 200))
    pygame.display.update()
    pygame.time.delay(1500)
    clock.tick()
コード例 #2
0
ファイル: run_game.py プロジェクト: benoxoft/pitfairyhunter
def show_intro():
    draw(1)
    w = Surface((640, 460))
    w.fill(pygame.color.Color('black'))
    w.blit(logo, (0,0))
    font = media.get_font(16)
    
    l1 = font.render('Use the arrow keys to move', True, (255,255,255))
    l2 = font.render('Press <spacebar> to activate your jetpack', True, (255,255,255))
    l3 = font.render('*** You need your jetpack to move in the air! ***', True, (255,255,255))
    l4 = font.render('Catch all fairies!' , True, (255,255,255))
    l5 = font.render('Avoid ghosts!', True, (255,255,255))

    lspace = font.render('Press <spacebar> to play', True, (255,255,255))
    lesc = font.render('Press <Esc> to quit', True, (255,255,255))
    lname = media.get_font(10).render('Everything by Benoit <benoxoft> Paquet', True, (255,255,255))

    x = 80
    w.blit(l1, (x, 180))
    w.blit(l2, (x, 210))
    w.blit(l3, (x, 240))
    w.blit(l4, (x, 290))
    w.blit(l5, (x, 320))
    
    w.blit(lspace, (30, 380))
    w.blit(lesc, (420, 380))
    w.blit(lname, (320 - lname.get_width() / 2, 440))
    
    screen.blit(w, (80, 80))    
    pygame.display.update()

    waiting = True    
    while waiting:
        for e in pygame.event.get():
            if e.type == pygame.KEYUP:
                if e.key == pygame.K_SPACE:
                    waiting = False
                elif e.key == pygame.K_ESCAPE:
                    import sys
                    sys.exit(0)
        
    pygame.time.delay(100)
    clock.tick()
コード例 #3
0
ファイル: run_game.py プロジェクト: benoxoft/mti880handcopter
def show_intro():
    draw(1)
    w = Surface((640, 460))
    w.fill(pygame.color.Color('black'))
    font = media.get_font(16)
    
    l1 = font.render('MTI880 Handcopter', True, (255,255,255))
    l2 = font.render('Open your hand to move up', True, (255,255,255))
    l3 = font.render('Close your hand to move down', True, (255,255,255))
    l4 = font.render('Avoid obstacles!' , True, (255,255,255))
    l5 = font.render('Avoid ghosts!', True, (255,255,255))

    lspace = font.render('Press <spacebar> to play', True, (255,255,255))
    lesc = font.render('Press <Esc> to quit', True, (255,255,255))
    lname = media.get_font(10).render('Everything by Benoit <benoxoft> Paquet', True, (255,255,255))

    x = 80
    w.blit(l1, (x, 180))
    w.blit(l2, (x, 210))
    w.blit(l3, (x, 240))
    w.blit(l4, (x, 290))
    #w.blit(l5, (x, 320))
    
    w.blit(lspace, (30, 380))
    w.blit(lesc, (420, 380))
    #w.blit(lname, (320 - lname.get_width() / 2, 440))
    
    screen.blit(w, (80, 80))    
    pygame.display.update()

    waiting = True    
    while waiting:
        for e in pygame.event.get():
            if e.type == pygame.KEYUP:
                if e.key == pygame.K_SPACE:
                    waiting = False
                elif e.key == pygame.K_ESCAPE:
                    import sys
                    sys.exit(0)
        
    pygame.time.delay(100)
    clock.tick()
コード例 #4
0
ファイル: run_game.py プロジェクト: benoxoft/mti880handcopter
def draw_elements(elements, tick):
    for element in elements:
        if tick > 0:
            element.update(tick)            
        screen.blit(element.image,
                        pygame.rect.Rect(element.rect.x - cam.x,
                                       element.rect.y - cam.y,
                                       element.rect.w - cam.w,
                                       element.rect.h - cam.h))
    font = media.get_font(32)
    l1 = font.render('Score: ' + str(mainchar.score), True, (255,255,255))
    l2 = font.render('Attempts left: ' + str(mainchar.lives), True, (255,255,255))
    
    screen.blit(l1, (60,0))
    screen.blit(l2, (420,0))
コード例 #5
0
ファイル: run_game.py プロジェクト: benoxoft/mti880handcopter
    print "Connected!"

    pygame.init()

    #game objects
    #screen = pygame.display.set_mode((800, 600))
    screen = pygame.display.set_mode((800, 600), pygame.HWSURFACE)

    pygame.display.set_caption('MTI880 Handcar!')
    pygame.mouse.set_visible(False)
    
    g = GameControl()
    
    #main character
    mainchar = MainChar()
    mainchar.no_more_life_event = no_more_life

    font = media.get_font(20)

    ui = GameUI(mainchar)
    cam = Camera(mainchar)

    levels = Levels()
    load_level(levels.get_next_level())

    clock = pygame.time.Clock()

    show_intro()

    main()