Beispiel #1
0
def mapgen_Area(InOut):
    if InOut == 0:
        global intro, out, level, fade_count, tempsc, mod, tempkeep
        tempkeep = ["intro", "out", "fade_count", "tempsc", "mod"]
        intro, out, fade_count, mod = 0, -1, 255, 0
    if intro == 0:
        fade_count -= 5
        level = hall([0, 0, "strt"], level)
        fader.image.set_alpha(fade_count)
        if len(level) > 5:
            tempsc = printmap(level)
            if fade_count <= 0:
                intro = -1
                out = 0
    if out >= 0:
        fade_count += 2
        fader.image.set_alpha(fade_count)
        if fade_count >= 0:
            mod = 9
    print(fade_count)

    'draw'
    screen.image.fill(WHITE)
    if len(level) > 5: tempsc.draw(screen.image)
    screen.image.blit(pointer.image, pointer.rect.center)
    screeneffects.draw(screen.image)

    return InOut + mod
Beispiel #2
0
 def CheckLevel(S):
     if -1 >= S.at[0]:
         map_at = hall([L, 0, "get_pos_change_room"], level)
         S.get_at("R")
     elif len(sala[0]) == S.at[0]:
         map_at = hall([R, 0, "get_pos_change_room"], level)
         S.get_at("L")
     elif -1 >= S.at[1]:
         map_at = hall([0, U, "get_pos_change_room"], level)
         S.get_at("D")
     elif len(sala) == S.at[1]:
         map_at = hall([0, D, "get_pos_change_room"], level)
         S.get_at("L")
     else:
         S.checkMap()
     temp2 = True
 def __init__(S):
     S.image = pygame.Surface([size, size])
     S.image.fill(BLACK)
     S.rect = S.image.get_rect()
     S.at = [1, 11]
     S.pos = [size * S.at[0] + offsets[0], size * S.at[1] + offsets[1]]
     S.Do = []
     S.turn = True
     S.jump = False
     S.air = False
     S.focus = False
     S.grab = False
     S.actualmap = hall([0, 0, "get pos"], 0)
Beispiel #4
0
def changeRoom(map_at, level):

    map_at = hall([0, 0, "get_pos_strt"], level)
    txt = "../Salas/" + level[map_at[1]][map_at[0]]
    sala = openSala(txt)
    tiles = mapread(sala)
    tile_breakable = pg.sprite.Group()
    size = getSize(sala)
    offsets = getOffset(sala, size, "sala")

    player1 = Corak()
    player1.update([0, 0, "get_at_S"])
    player1.update([0, 0, "Map"])
    temp3 = False
Beispiel #5
0
def CheckLevel(mapAt):
    out = -1
    come_from = ""

    if corak.at[0] < 0:
        mapAt[0] += L
        come_from = "R"
        out = 2
    elif corak.at[0] >= len(sala[0]):
        mapAt[0] += R
        come_from = "L"
        out = 2
    elif corak.at[1] < 0:
        mapAt[1] += U
        come_from = "D"
        out = 2
    elif corak.at[1] >= len(sala):
        mapAt[1] += D
        come_from = "U"
        out = 2
    elif sala[corak.at[1]][corak.at[0]] in "x":
        out = 2
        mapAt[0] += 1
        if mapAt[0] > 4:
            out = 4
            mapAt = hall([0, 0, "get_pos_strt"], level)

    elif sala[corak.at[1]][corak.at[0]] in "R":
        out = 3

    else: corak.checkMap()

    return mapAt, out, come_from


    screeneffects.draw(screen)
    screen.blit(pointer.image, pointer.rect.center)
Beispiel #6
0
def play_Area(InOut):
    screen
    if InOut == 0:
        global intro, out, fade_count, mod
        global sala, offsets, size, tiles_breakable, background, tiles_draw, tiles_base
        global moveLight, corak, map_at, temp4, frame
        intro, out, fade_count, mod = 4, -1, 0, 0
        frame = 0
        #map_at = [0,0,0,0]
        map_at = hall([0, 0, "get_pos_strt"], level)
    if intro >= 0:
        if intro >= 1:
            sala, offsets, size, tiles_breakable, background, tiles_draw, tiles_base = changeRoom(map_at, level)
            moveLight = 1

            if intro >= 4:
                background.image.fill(BLACK)
                tiles_draw.image.fill(WHITE2)
                tiles_draw.image.blit(tiles_base.image, (0, 0))
                tiles_draw.image.set_colorkey(WHITE2)

                if intro == 4: corak = Corak()
                corak.get_at("S")
                corak.checkMap()
                if map_at[0] >= 4:
                    intro = 1

            elif intro == 1:
                background.image.fill(CUSTOM2)
                tiles_draw.image.fill(CUSTOM)
                tiles_draw.image.blit(tiles_base.image, (0, 0))
                tiles_draw.image.set_colorkey(CUSTOM)

                corak = Corak()
                map_at = hall([0, 0, "get_pos_strt"], level)
                corak.get_at("S")
                corak.checkMap()
                intro = -1

            elif intro == 2:
                background.image.fill(CUSTOM3)
                tiles_draw.image.fill(CUSTOM)
                tiles_draw.image.blit(tiles_base.image, (0, 0))
                tiles_draw.image.set_colorkey(CUSTOM)
                corak.get_at(temp4)
            elif intro == 3:
                corak.get_at("0")

            # scale
            corak.modLight[1] = (size * int(upscale * 2.5)) * corak.modLight[0]
            corak.sprite.image = pg.transform.scale(corak.sprite.image, (size, size))
            pointerLight.image = pg.transform.scale(playerLight.image, (corak.modLight[1], corak.modLight[1]))
            playerLight.image = pg.transform.scale(playerLight.image, (corak.modLight[1], corak.modLight[1]))

            if "mod-" in level[map_at[1]][map_at[0]]:

                background.image.fill(CUSTOM2)
                tiles_draw.image.fill(CRED)
                tiles_draw.image.blit(tiles_base.image, (0, 0))
                tiles_draw.image.set_colorkey(CRED)

            print(corak.at, map_at, level[map_at[1]][map_at[0]])

            intro = 0
            corak.Do = [0, 0, "Z"]
        fade_count -= 5
        if fade_count <= 0: intro = -1
        fader.image.set_alpha(fade_count)
    if out >= 0:

        fade_count += 7
        if fade_count >= 250:
            if out == 1: intro = 1
            if out == 2: intro = 2
            if out == 3: intro = 3
            if out == 4: intro = 4
            if out == 5: intro = 5
            out = -1
        fader.image.set_alpha(fade_count)
    '''
    if pause_area:
        menuCount = 0
        if clickset == 1: clickset = 0

        screen.image.blit(tempscreen.image, (0, 0))
        'input'
        for button in menu[0]:
            screen.image.blit(button.image, button.rect)
            if button.rect.collidepoint(pointer.rect.center):
                button.setFrame([0, 1])
                if click:
                    if not menuTrigger[1][0]:
                        menuTrigger[1][0] = True
                        menuTrigger[1][1] = True
                    fade = True
                    temp3 = False
                    button.setFrame([0, 2])
                if clickset == 1:
                    clickset = 2
                    if "start" in button.type:
                        if not menuTrigger[2][0]:
                            menuTrigger[2][0] = True
                            menuTrigger[2][1] = True
                        intro = 3
                        out = 3
                    if "options" in button.type:
                        menuTrigger[1][0] = False
                        trigger[2] = True
                        pointer.setFrame([0, pointer.frame[1] + 1])
                    if "exit" in button.type:
                        out = 0
                        temp2 = True
                if not menuTrigger[0][0]:
                    menuTrigger[0][0] = True
                    menuTrigger[0][1] = True

                menuCount += 1

            else:
                button.setFrame([0, 0])

        if menuCount == 0:
            menuTrigger[0][0], menuTrigger[2][0] = False, False

        screen.image.blit(pointer.image, pointer.rect.center)
    '''

    if clickset:
        tiles_draw.image.fill(GRAY)
        tiles_draw.image.set_colorkey(GRAY)

        tiles_draw.image.fill(RGB)
        tiles_draw.image.set_colorkey(RGB)
        tiles_draw.image.blit(tiles_base.image, (0, 0))
    if click: background.image.fill((20, 10, 10))

    if keypress:
        corak.update(corak.Do)
        map_at, out, temp4 = CheckLevel(map_at)

    corak.posoffset()
    'frame'
    # air
    if corak.air:
        frame += 1
        if frame > 1: frame = 0
        corak.sprite.setFrame([2, frame])
    # grab
    if corak.grab:
        frame += 1
        if frame > 1: frame = 0
        corak.sprite.setFrame([1, frame])
    # jump
    if "U" in corak.Do[2]:
        frame += 1
        if frame > 3: frame = 0
        corak.sprite.setFrame([3, frame])
    # ground
    elif not corak.air:
        frame = 1
        corak.sprite.setFrame([0, frame])
    # focus
    if corak.focus:
        frame = 0
        corak.sprite.setFrame([4, frame])
    # dash
    if not corak.at[0] * size - 0.01 < corak.pos_offsetX < corak.at[0] * size + 0.01:
        frame = 1
        corak.sprite.setFrame([4, frame])
    # air
    if not corak.at[1] * size - 0.02 < corak.pos_offsetY:
        frame = +1
        if frame > 1: frame = 0
        corak.sprite.setFrame([2, frame])
    if corak.left or corak.Do[0] == -1: corak.sprite.image = pg.transform.flip(corak.sprite.image, True, False)

    'draw'
    screen.image.blit(background.image, background.rect)
    # tiles.draw(screen.image)
    screen.image.blit(corak.sprite.image, corak.sprite.rect)
    screen.image.blit(tiles_draw.image, tiles_draw.rect)
    # screen.image.blit(tiles_deco.image, tiles_deco.rect)
    tiles_breakable.draw(screen.image)
    screen.image.blit(pointer.image, pointer.rect.center)
    if temp2:
        fader2.image.set_alpha(fade_count)
        counterlight.image.fill(BLACK)

        pointerLight.update((mx, my))
        counterlight.image.blit(pointerLight.image, pointerLight.rect)

        playerLight.update(corak.sprite.rect.center)
        counterlight.image.blit(playerLight.image, playerLight.rect)

        counterlight.image.set_alpha(moveLight)

        fader2.image.fill(BLACK)
        fader2.image.set_alpha(moveLight)

        screen.image.blit(counterlight.image, (0, 0), special_flags=pg.BLEND_MULT)
        screen.image.blit(fader2.image, (0, 0))
    if temp2: screen.image.blit(pointer.image, pointer.rect.center)

    if moveLight < 150:
        moveLight += 1.5

    screeneffects.draw(screen.image)
    return InOut + mod
Beispiel #7
0
                fader.image.set_alpha(fade_count)
         '''

        'draw'
        screen.image.fill(CUSTOM)
        for button in menu[i]:
            screen.image.blit(button.image, button.rect)
        if opt_menu:
            screen.image.blit(tempBlit.image, (0, 0))

        screen.image.blit(pointer.image, pointer.rect.center)
        screeneffects.draw(screen.image)
    if mapgen_area:
        'in out'
        if intro == 0:
            level = hall([0, 0, "strt"], level)
            fade_count -= 5
            fader.image.set_alpha(fade_count)
            if len(level) > 5:
                temp = True
                if fade_count <= 0:
                    intro = -1
                    out = 0
        if out >= 0:
            fade_count += 2
            fader.image.set_alpha(fade_count)
            if fade_count >= 50:
                intro = 1
                #map_at = [0, "0", "0", "0"]

                map_at = hall([0, 0, "get_pos_strt"], level)
Beispiel #8
0
def view(actual):
    level = hall([0, 0, "strt"], 0)
    if len(level) == 4:
        return actual

    mapview = pygame.sprite.Group()
    while len(alltiles) > 0:
        del alltiles[0]
    for andar in range(len(level)):
        for sala in range(len(level[andar])):
            if "UDcorridor" in level[andar][sala]:
                for temp in range(0, 3):
                    tile = [
                        Tile(level[andar][sala], 9, andar * 27 + (9 * temp),
                             sala * 27)
                    ]
                    mapview.add(tile)
                for temp in range(0, 3):
                    tile = [
                        Tile(level[andar][sala], 9, andar * 27 + (9 * temp),
                             sala * 27 + (9 * 2))
                    ]
                    mapview.add(tile)
            if "LRcorridor" in level[andar][sala]:
                for temp in range(0, 3):
                    tile = [
                        Tile(level[andar][sala], 9, andar * 27,
                             sala * 27 + (9 * temp))
                    ]
                    mapview.add(tile)
                for temp in range(0, 3):
                    tile = [
                        Tile(level[andar][sala], 9, andar * 27 + (9 * 2),
                             sala * 27 + (9 * temp))
                    ]
                    mapview.add(tile)
            if "LDturn" in level[andar][sala]:
                for temp in range(0, 3):
                    tile = [
                        Tile(level[andar][sala], 9, andar * 27,
                             sala * 27 + (9 * temp))
                    ]
                    mapview.add(tile)
                tile = Tile(level[andar][sala], 9, andar * 27 + 9,
                            sala * 27 + (9 * 2))
                mapview.add(tile)
                tile = [
                    Tile(level[andar][sala], 9, andar * 27 + (9 * 2),
                         sala * 27),
                    Tile(level[andar][sala], 9, andar * 27 + (9 * 2),
                         sala * 27 + (9 * 2))
                ]
                mapview.add(tile)
            if "RDturn" in level[andar][sala]:
                for temp in range(0, 3):
                    tile = [
                        Tile(level[andar][sala], 9, andar * 27,
                             sala * 27 + (9 * temp))
                    ]
                    mapview.add(tile)
                tile = Tile(level[andar][sala], 9, andar * 27 + 9, sala * 27)
                mapview.add(tile)
                tile = [
                    Tile(level[andar][sala], 9, andar * 27 + (9 * 2),
                         sala * 27),
                    Tile(level[andar][sala], 9, andar * 27 + (9 * 2),
                         sala * 27 + (9 * 2))
                ]
                mapview.add(tile)
            if "RUturn" in level[andar][sala]:
                for temp in range(0, 3):
                    tile = [
                        Tile(level[andar][sala], 9, andar * 27 + (9 * temp),
                             sala * 27)
                    ]
                    mapview.add(tile)
                tile = Tile(level[andar][sala], 9, andar * 27,
                            sala * 27 + (9 * 2))
                mapview.add(tile)
                for temp in range(1, 3):
                    tile = [
                        Tile(level[andar][sala], 9, andar * 27 + (9 * 2),
                             sala * 27 + (9 * temp))
                    ]
                    mapview.add(tile)
            if "LUturn" in level[andar][sala]:
                for temp in range(0, 3):
                    tile = [
                        Tile(level[andar][sala], 9, andar * 27 + (9 * temp),
                             sala * 27 + (9 * 2))
                    ]
                    mapview.add(tile)
                tile = Tile(level[andar][sala], 9, andar * 27, sala * 27)
                mapview.add(tile)
                for temp in range(0, 2):
                    tile = [
                        Tile(level[andar][sala], 9, andar * 27 + (9 * 2),
                             sala * 27 + (9 * temp))
                    ]
                    mapview.add(tile)
            if "Uroom" in level[andar][sala]:
                for temp in range(0, 3):
                    tile = [
                        Tile(level[andar][sala], 9, andar * 27 + (9 * temp),
                             sala * 27 + (9 * 2))
                    ]
                    mapview.add(tile)
                for temp in range(0, 3):
                    tile = [
                        Tile(level[andar][sala], 9, andar * 27 + (9 * temp),
                             sala * 27)
                    ]
                    mapview.add(tile)
                tile = Tile(level[andar][sala], 9, andar * 27 + (9 * 2),
                            sala * 27 + 9)
                mapview.add(tile)
            if "Droom" in level[andar][sala]:
                for temp in range(0, 3):
                    tile = [
                        Tile(level[andar][sala], 9, andar * 27 + (9 * temp),
                             sala * 27 + (9 * 2))
                    ]
                    mapview.add(tile)
                for temp in range(0, 3):
                    tile = [
                        Tile(level[andar][sala], 9, andar * 27 + (9 * temp),
                             sala * 27)
                    ]
                    mapview.add(tile)
                tile = Tile(level[andar][sala], 9, andar * 27, sala * 27 + 9)
                mapview.add(tile)
            if "Rroom" in level[andar][sala]:
                for temp in range(0, 3):
                    tile = [
                        Tile(level[andar][sala], 9, andar * 27,
                             sala * 27 + (9 * temp))
                    ]
                    mapview.add(tile)
                for temp in range(0, 3):
                    tile = [
                        Tile(level[andar][sala], 9, andar * 27 + (9 * 2),
                             sala * 27 + (9 * temp))
                    ]
                    mapview.add(tile)
                tile = Tile(level[andar][sala], 9, andar * 27 + 9, sala * 27)
                mapview.add(tile)
            if "Lroom" in level[andar][sala]:
                for temp in range(0, 3):
                    tile = [
                        Tile(level[andar][sala], 9, andar * 27,
                             sala * 27 + (9 * temp))
                    ]
                    mapview.add(tile)
                for temp in range(0, 3):
                    tile = [
                        Tile(level[andar][sala], 9, andar * 27 + (9 * 2),
                             sala * 27 + (9 * temp))
                    ]
                    mapview.add(tile)
                tile = Tile(level[andar][sala], 9, andar * 27 + 9,
                            sala * 27 + (9 * 2))
                mapview.add(tile)
            if "hall" in level[andar][sala]:
                tile = Tile(level[andar][sala], 9, andar * 27, sala * 27)
                mapview.add(tile)
                tile = Tile(level[andar][sala], 9, andar * 27,
                            sala * 27 + (9 * 2))
                mapview.add(tile)
                tile = Tile(level[andar][sala], 9, andar * 27 + (9 * 2),
                            sala * 27)
                mapview.add(tile)
                tile = Tile(level[andar][sala], 9, andar * 27 + (9 * 2),
                            sala * 27 + (9 * 2))
                mapview.add(tile)
            if "LUD3" in level[andar][sala]:
                for temp in range(0, 3):
                    tile = [
                        Tile(level[andar][sala], 9, andar * 27 + (9 * temp),
                             sala * 27 + (9 * 2))
                    ]
                    mapview.add(tile)
                    tile = Tile(level[andar][sala], 9, andar * 27, sala * 27)
                    mapview.add(tile)
                    tile = Tile(level[andar][sala], 9, andar * 27 + (9 * 2),
                                sala * 27)
                    mapview.add(tile)
            if "RUD3" in level[andar][sala]:
                for temp in range(0, 3):
                    tile = [
                        Tile(level[andar][sala], 9, andar * 27 + (9 * temp),
                             sala * 27)
                    ]
                    mapview.add(tile)
                    tile = Tile(level[andar][sala], 9, andar * 27,
                                sala * 27 + (9 * 2))
                    mapview.add(tile)
                    tile = Tile(level[andar][sala], 9, andar * 27 + (9 * 2),
                                sala * 27 + (9 * 2))
                    mapview.add(tile)
            if "LRD3" in level[andar][sala]:
                for temp in range(0, 3):
                    tile = [
                        Tile(level[andar][sala], 9, andar * 27,
                             sala * 27 + (9 * temp))
                    ]
                    mapview.add(tile)
                tile = Tile(level[andar][sala], 9, andar * 27 + (9 * 2),
                            sala * 27)
                mapview.add(tile)
                tile = Tile(level[andar][sala], 9, andar * 27 + (9 * 2),
                            sala * 27 + (9 * 2))
                mapview.add(tile)
            if "LRU3" in level[andar][sala]:
                for temp in range(0, 3):
                    tile = [
                        Tile(level[andar][sala], 9, andar * 27 + (9 * 2),
                             sala * 27 + (9 * temp))
                    ]
                    mapview.add(tile)
                tile = Tile(level[andar][sala], 9, andar * 27,
                            sala * 27 + (9 * 2))
                mapview.add(tile)
                tile = Tile(level[andar][sala], 9, andar * 27 + (9 * 2),
                            sala * 27 + (9 * 2))
                mapview.add(tile)
                tile = Tile(level[andar][sala], 9, andar * 27, sala * 27)
                mapview.add(tile)
            if "Blank" in level[andar][sala]:
                for temp in range(0, 3):
                    for temp2 in range(0, 3):
                        tile = [
                            Tile(level[andar][sala], 9,
                                 andar * 27 + (9 * temp2),
                                 sala * 27 + (9 * temp))
                        ]
                        mapview.add(tile)

    return mapview