コード例 #1
0
ファイル: drawstuff.py プロジェクト: bhargavaganti/anki-eeg
def recognize_slide(word, size=100):
    screen.fill(background_color)
    p = screen.get_rect().center
    draw_text(word, p, size=size)

    draw_text("1=unknown", (200, SCREEN_HEIGHT-100), size=50)
    draw_text("4=recognized", (SCREEN_WIDTH-250, SCREEN_HEIGHT-100), size=50)

    pygame.display.flip()
コード例 #2
0
ファイル: drawstuff.py プロジェクト: bhargavaganti/anki-eeg
def text_slide(text, size=30):
    screen.fill(background_color)
    lines = text.split('\n')
    rect = draw_text('test', (SCREEN_WIDTH/2, SCREEN_HEIGHT/2),
                     size=size, color=background_color)
    height = rect.height + 6
    y = SCREEN_HEIGHT/2 - (len(lines)-1)*(height/2)
    for line in lines:
        draw_text(line.strip(), (SCREEN_WIDTH/2, y), size=size)
        y += height
    pygame.display.flip()
コード例 #3
0
ファイル: drawstuff.py プロジェクト: bhargavaganti/anki-eeg
def simple_slide(text, size=100):
    screen.fill(background_color)
    p = screen.get_rect().center
    draw_text(text, p, size=size)
    pygame.display.flip()
コード例 #4
0
def image_slide(img):
    screen.fill(background_color)
    rect = draw_image(img, (SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2))
    pygame.display.update(rect)
コード例 #5
0
ファイル: drawstuff.py プロジェクト: bhargavaganti/anki-eeg
def focus_slide():
    screen.fill(background_color)
    draw_focus_screen()
    pygame.display.flip()
コード例 #6
0
#         if round(j, 5) == 0:
#             new_point.set_color((50, 255, 0))

#         if i > -input_range:
#             new_point.add_friend(points[-1])

#         if j > -input_range:
#             index = -math.ceil(input_range * 2 / dt + 1)
#             new_point.add_friend(points[index])

#         points.append(new_point)

running = True
while running:

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

    screen.fill((0, 0, 0))

    for point in points:
        point.show(scale)

    for point in points:
        point.update()

    pygame.display.flip()

pygame.quit()
コード例 #7
0
ファイル: main.py プロジェクト: samielvaughan/GLEC
            dx = 0
        elif event.type == KEYUP and event.key == K_RIGHT:
            dx = 0
        elif event.type == KEYDOWN and event.key == K_r:
            run = True
        elif event.type == KEYUP and event.key == K_r:
            run = False
        elif event.type == KEYDOWN and event.key == K_t:
            dash = True
        elif event.type == KEYUP and event.key == K_t:
            dash = False
        elif event.type == KEYDOWN and event.key == K_s:
            pygame.image.save(real.img, \Desktop\world"+str(frame)+".png" )


    screen.fill(Color('black'))
    real.update(dx, dy, run, dash)

    screen.blit(real.img, real.pos)
#    screen.blit(sams_health.img, sams_health.position)

    pygame.display.update()








コード例 #8
0
        elif event.type == KEYDOWN and event.key == K_LEFT:
            dx = -1
        elif event.type == KEYDOWN and event.key == K_RIGHT:
            dx = 1
        elif event.type == KEYUP and event.key == K_UP:
            dy = 0
        elif event.type == KEYUP and event.key == K_DOWN:
            dy = 0
        elif event.type == KEYUP and event.key == K_LEFT:
            dx = 0
        elif event.type == KEYUP and event.key == K_RIGHT:
            dx = 0
        elif event.type == KEYDOWN and event.key == K_r:
            run = True
        elif event.type == KEYUP and event.key == K_r:
            run = False
        elif event.type == KEYDOWN and event.key == K_t:
            dash = True
        elif event.type == KEYUP and event.key == K_t:
            dash = False

    dx = dx
    dy = dy
    screen.fill(black)
    real.update(dx, dy, run, dash)

    screen.blit(real.img, real.p_pos)
    #    screen.blit(sams_health.img, sams_health.position)

    pygame.display.update()
コード例 #9
0
def game(walls,
         floor,
         wall_1,
         wall_2,
         wall_3,
         wall_4,
         chest,
         gg_right,
         gg_left,
         gg_sprite,
         gg_stop_r,
         gg_stop_l,
         lvl,
         el=None,
         gerl=None,
         npc=None,
         npc_boss=None):
    move_right = False
    move_left = False
    move_up = False
    move_down = False
    text1 = False
    text4 = False
    text11 = False
    text21 = False
    direction = 2
    enter_press = False
    f_press = False
    n_press = False
    running = True
    while running:
        screen.fill(pygame.Color("black"))
        gg_stop_l.rect = gg_sprite.rect
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False
            if event.type == pygame.KEYDOWN and (event.key == pygame.K_LEFT
                                                 or event.key == pygame.K_a):
                move_left = True
                direction = 1
                gg_sprite.frames = gg_left.frames
            if event.type == pygame.KEYUP and (event.key == pygame.K_LEFT
                                               or event.key == pygame.K_a):
                move_left = False

            if event.type == pygame.KEYDOWN and (event.key == pygame.K_RIGHT
                                                 or event.key == pygame.K_d):
                move_right = True
                direction = 2
                gg_sprite.frames = gg_right.frames
            if event.type == pygame.KEYUP and (event.key == pygame.K_RIGHT
                                               or event.key == pygame.K_d):
                move_right = False

            if event.type == pygame.KEYDOWN and (event.key == pygame.K_UP
                                                 or event.key == pygame.K_w):
                move_up = True
                if direction == 1:
                    gg_sprite.frames = gg_left.frames
                elif direction == 2:
                    gg_sprite.frames = gg_right.frames
            if event.type == pygame.KEYUP and (event.key == pygame.K_UP
                                               or event.key == pygame.K_w):
                move_up = False

            if event.type == pygame.KEYDOWN and (event.key == pygame.K_DOWN
                                                 or event.key == pygame.K_s):
                move_down = True
                if direction == 1:
                    gg_sprite.frames = gg_left.frames
                elif direction == 2:
                    gg_sprite.frames = gg_right.frames
            if event.type == pygame.KEYUP and (event.key == pygame.K_DOWN
                                               or event.key == pygame.K_s):
                move_down = False

            if event.type == pygame.KEYUP and event.key == pygame.K_n:
                if n_press:
                    if lvl == 'lvl1':
                        if not text4:
                            sprites_note.add(scroll_npc)
                            text4 = True
                        else:
                            sprites_note.remove(scroll_npc)
                            text4 = False
                            return
                    else:
                        if not text21:
                            sprites_note.add(scroll_npc2)
                            text21 = True
                        else:
                            sprites_note.remove(scroll_npc2)
                            text21 = False
                            return
            if event.type == pygame.KEYUP and event.key == pygame.K_f:
                if f_press:
                    if lvl == 'lvl1':
                        if not text1:
                            sprites_note.add(scroll)
                            text1 = True
                        else:
                            sprites_note.remove(scroll)
                            text1 = False
                    else:
                        if not text11:
                            sprites_note.add(scroll2)
                            text11 = True
                        else:
                            sprites_note.remove(scroll2)
                            text11 = False

            if event.type == pygame.KEYUP and event.key == pygame.K_e:
                if enter_press:
                    fighting()
                    win()
                    running = False
            if event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
                screen_start(lvl, floor, wall_1, wall_2, wall_3, wall_4, chest,
                             gg_left, gg_sprite, el, gerl, npc, npc_boss)

        camera.update(gg_sprite, width, height)
        for sprite in all_sprites:
            camera.apply(sprite)
        if not text1 and not text11 and not text4 and not text21:
            if move_left:
                gg_sprite.rect.x -= s

            if move_right:
                gg_sprite.rect.x += s

            if move_down:
                gg_sprite.rect.y += s

            if move_up:
                gg_sprite.rect.y -= s

        if not move_right and not move_up and not move_left and not move_down:
            if direction == 1:
                gg_sprite.frames = gg_stop_l.frames
            elif direction == 2:
                gg_sprite.frames = gg_stop_r.frames

        for wall in walls:
            if pygame.sprite.collide_mask(gg_stop_l, wall):
                if move_up:
                    gg_sprite.rect.y += s
                if move_down:
                    gg_sprite.rect.y -= s
                if move_right:
                    gg_sprite.rect.x -= s
                if move_left:
                    gg_sprite.rect.x += s

        all_sprites.draw(screen)
        all_sprites.update()
        clock.tick(150)
        f_press = False
        if lvl != 'lvl3':
            if pygame.sprite.collide_rect(gg_stop_l, npc):
                screen.blit(text2, (350, 600))
                n_press = True
        if lvl == 'lvl3':
            if pygame.sprite.collide_rect(gg_stop_l, npc_boss):
                screen.blit(text5, (350, 600))
                enter_press = True
        if pygame.sprite.collide_rect(gg_stop_l, chest):
            screen.blit(text3, (350, 600))
            f_press = True
        if text1:
            sprites_note.draw(screen)
            scroll.read()
        if text11:
            sprites_note.draw(screen)
            scroll2.read()
        if text21:
            sprites_note.draw(screen)
            scroll_npc2.read()
        if text4:
            sprites_note.draw(screen)
            scroll_npc.read()
        pygame.display.update()
        pygame.display.flip()
    save(lvl, floor, wall_1, wall_2, wall_3, wall_4, chest, gg_left, gg_sprite,
         el, gerl, npc, npc_boss)
    pygame.quit()
コード例 #10
0
ファイル: main.py プロジェクト: DavidBurnward/GSAM
        elif event.type == KEYDOWN and event.key == K_LEFT:
            dx = -1
        elif event.type == KEYDOWN and event.key == K_RIGHT:
            dx = 1
        elif event.type == KEYUP and event.key == K_UP:
            dy = 0
        elif event.type == KEYUP and event.key == K_DOWN:
            dy = 0
        elif event.type == KEYUP and event.key == K_LEFT:
            dx = 0
        elif event.type == KEYUP and event.key == K_RIGHT:
            dx = 0
        elif event.type == KEYDOWN and event.key == K_r:
            run = True
        elif event.type == KEYUP and event.key == K_r:
            run = False
        elif event.type == KEYDOWN and event.key == K_t:
            dash = True
        elif event.type == KEYUP and event.key == K_t:
            dash = False

    dx = dx
    dy = dy
    screen.fill(black)
    real.update(dx, dy, run, dash)

    screen.blit(real.img, real.p_pos)
    #    screen.blit(sams_health.img, sams_health.position)

    pygame.display.update()