Пример #1
0
    "getitem": {"f": "getItem"},
    "battle": {"f": "subBattle", "args": ["$1"]},
    "activate": {"f": "setChar", "args": ["$1"]},
}
glob = {
    "message": message,
    "playSound": playSound,
    "updateOverWorld": updateOverWorld,
    "eventQuit": eventQuit,
    "getItem": getItem,
    "subBattle": subBattle,
    "updateRPG": updateRPG,
    "setChar": setChar,
    "battleFinish": battleFinish,
}
udebs.importModule(local, glob)
main_map = udebs.battleStart("xml/zanar2.xml")
battle = udebs.battleStart("xml/rpg.xml")

main_map.controlInit("init")


def main():
    # game loop
    while True:
        for event in pygame.event.get():
            if event.type == QUIT:
                eventQuit()

            elif event.type == MOUSEBUTTONDOWN:
                mouse = pygame.mouse.get_pos()
Пример #2
0
        if main_map.getStat(target, "LIFE"):
            rect = pygame.Rect(target.loc[0]*(ts), target.loc[1]*(ts), ts, ts)
            pygame.draw.rect(surface, (100,200,100, 127), rect)

    pygame.display.update()

def dedup(lst):
    return list(set(lst))

if __name__ == "__main__":
    # Setup Udebs
    module = {"dedup": {
        "f": "dedup",
        "args": ["$1"],
    }}
    udebs.importModule(module, {"dedup": dedup})

     # State variables
    ts = 10
    field = udebs.battleStart("xml/life.xml")

    #Setup pygame
    pygame.init()
    pygame.display.set_caption("Conway's game of life.")
    surface = pygame.display.set_mode((ts*field.getMap().x, ts*field.getMap().y), 0, 32)
    mainClock = pygame.time.Clock()

#    #game loop
    for main_map in field.gameLoop(1):
        redrawBoard(surface, ts)
        mainClock.tick(60)
Пример #3
0
                    return False

    for unit in instance.getGroup(color):
        if "captured" not in instance.getStat(unit, "status"):
            for move in instance.getStat(unit, 'movelist'):
                if move not in {"pawn_travel", "pawn_double", "king_kcastle", "king_qcastle"}:
                    if instance.testMove(unit, king, move):
                        return False

    return True

module = {"check": {
    "f": "check",
    "args": ["$1", "$2", "self"],
}}
udebs.importModule(module, {"check": check})
main_map = udebs.battleStart("xml/chess.xml")
main_map.controlInit('init')
main_map.resetState()

#globals
BLACK = (0,0,0)
GREEN = (100,200,100, 127)
RED = (200, 0, 0, 127)
high = set()
activeUnit = False
moves = {}

def redrawBoard():
    surface.fill(BLACK)
    for x in range(10):