elif event.key == pygame.K_c: classes = { "Object": Object, "Wall": Wall, "CircleWall": CircleWall, "SquareWall": SquareWall, "RightTriangleWall": RightTriangleWall, } s = classes[choicebox(screen, classes.keys(), "Select a type of object:")] i = enterbox(screen, "Enter image path:") tool = make_tool_create(s, i) elif event.key == pygame.K_s: save(objects) elif event.key == pygame.K_p: save(objects) runlevel(screen, levelname, True) elif event.key == pygame.K_x: tool = tool_delete elif event.key == pygame.K_f: forces = [] for o in objects: if "forces" in o[2]: forces.append(o) choices = [] for f in forces: choices.append(f[0].__name__) choices.append("Create new") choice = choicebox(screen, choices, "Force Manager") if choice == "Create new": kind = {"Gravity": Gravity} k = kind[choicebox(screen, kind.keys(), "Select a type of force:")]
v=o[1][k] inst=v should=o[0].props[k] if should=="str": inst=repr(v) elif should=="int": inst=repr(v) elif should=="bool": inst=repr(v) elif should=="Vector": inst="Vector("+str(v.x)+","+str(v.y)+")" d=d+k+"="+inst+" " f.write(o[0].__name__+" "+d+"##"+" ".join(o[2])) f.write("\n") f.close() main.runlevel(screen, levelname) if event.key==pygame.K_TAB: selected=classes[choicebox(screen, classes.keys(), "Select a type of object:")] if event.key==pygame.K_1: if images[1]==None: images[1]=enterbox(screen, "Enter image path to load:") else: image=images[1] if event.key==pygame.K_2: if images[2]==None: images[2]=enterbox(screen, "Enter image path to load:") else: image=images[2] if event.key==pygame.K_3: if images[3]==None: images[3]=enterbox(screen, "Enter image path to load:")