def init(): quest.quests["Act1"].available = True state.shipyard = { "Skiff": 600, "Mapper": 600, "Beacon": 600, } state.you = thing.Skiff(X = 0, y = state.R - 5, vx = 1) state.ships = [state.you] state.mother = thing.Mother(X = 0, y = state.R + 8) state.objs = [state.mother] # state.filaments = [thing.Filament(ladderps = state.worlddata["filaments"][0])] state.hazards = [] for _ in range(500): X = random.uniform(0, math.tau) y = math.sqrt(random.uniform(state.Rcore ** 2, state.R ** 2)) state.hazards.append(thing.Slash(X = X, y = y)) for filament in state.worlddata["filaments"]: for j in range(len(filament) - 1): X0, y0 = filament[j] X1, y1 = filament[j+1] dX, dy = X1 - X0, y1 - y0 state.hazards.append(thing.Rung(X = X0, y = y0)) state.hazards.append(thing.Rung(X = X0 + dX / 3, y = y0 + dy / 3)) state.hazards.append(thing.Rung(X = X0 + dX * 2 / 3, y = y0 + dy * 2 / 3)) window.camera.follow(state.you) window.camera.think(0) populatefull() sound.playgamemusic()
def init(): quest.quests["Act1"].available = True state.shipyard = { "Skiff": 600, "Mapper": 600, "Beacon": 600, } state.you = thing.Skiff(X=0, y=state.R - 5, vx=1) state.ships = [state.you] state.mother = thing.Mother(X=0, y=state.R + 8) state.objs = [state.mother] # state.filaments = [thing.Filament(ladderps = state.worlddata["filaments"][0])] state.hazards = [] for _ in range(500): X = random.uniform(0, math.tau) y = math.sqrt(random.uniform(state.Rcore**2, state.R**2)) state.hazards.append(thing.Slash(X=X, y=y)) for filament in state.worlddata["filaments"]: for j in range(len(filament) - 1): X0, y0 = filament[j] X1, y1 = filament[j + 1] dX, dy = X1 - X0, y1 - y0 state.hazards.append(thing.Rung(X=X0, y=y0)) state.hazards.append(thing.Rung(X=X0 + dX / 3, y=y0 + dy / 3)) state.hazards.append( thing.Rung(X=X0 + dX * 2 / 3, y=y0 + dy * 2 / 3)) window.camera.follow(state.you) window.camera.think(0) populatefull() sound.playgamemusic()
from src import settings, thing, window, ptext, state, background, scene, sound from src.window import F from src.scenes import play, intro, title, finalcutscene, endtitle ptext.FONT_NAME_TEMPLATE = os.path.join("data", "fonts", "%s.ttf") window.init() pygame.display.set_caption(settings.gamename) pygame.mixer.init() background.init() sound.init() if os.path.exists(settings.savename): scene.current = play scene.toinit = None sound.playgamemusic() background.wash() state.load() else: scene.current = intro scene.toinit = intro title.drawtitle() clock = pygame.time.Clock() playing = True tconfirmfull = 0 while playing: dt = min(clock.tick(settings.maxfps) * 0.001, 1 / settings.minfps) class Event(object): def __init__(self, event): self.type = event.type
from src import settings, thing, window, ptext, state, background, scene, sound from src.window import F from src.scenes import play, intro, title, finalcutscene, endtitle ptext.FONT_NAME_TEMPLATE = os.path.join("data", "fonts", "%s.ttf") window.init() pygame.display.set_caption(settings.gamename) pygame.mixer.init() background.init() sound.init() if os.path.exists(settings.savename): scene.current = play scene.toinit = None sound.playgamemusic() background.wash() state.load() else: scene.current = intro scene.toinit = intro title.drawtitle() clock = pygame.time.Clock() playing = True tconfirmfull = 0 while playing: dt = min(clock.tick(settings.maxfps) * 0.001, 1 / settings.minfps) class Event(object): def __init__(self, event):