def regenerate(): target = thing.Skiff(X = state.mother.X, y = state.mother.y - 11, vx = 0) state.you = thing.SlowTeleport(X = state.you.X, y = state.you.y, targetid = target.thingid) state.ships.append(target) state.effects.append(state.you) sound.play("longteleport") control.clear() dialog.play("convo5")
def regenerate(): target = thing.Skiff(X=state.mother.X, y=state.mother.y - 11, vx=0) state.you = thing.SlowTeleport(X=state.you.X, y=state.you.y, targetid=target.thingid) state.ships.append(target) state.effects.append(state.you) sound.play("longteleport") control.clear() dialog.play("convo5")
def init(): global tplay window.camera.X0 = 0 window.camera.y0 = 500 window.camera.R = window.sy / 40 sound.epicness = 2 dialog.play("convo16") tplay = 0 background.wash() state.you = getattr(thing, quest.quests["Finale"].winner)(X = 0, y = window.camera.y0 + 20) state.effects = []
def regenerate(): state.you = thing.Skiff(X = state.mother.X, y = state.mother.y - 11, vx = 0) window.camera.X0 = state.you.X window.camera.y0 = state.you.y state.ships.append(state.you) clearfull() populatefull() sound.play("longteleport") control.clear() dialog.play("convo5") background.wash() background.drawwash() if settings.saveonemergency: state.save()
def regenerate(): state.you = thing.Skiff(X=state.mother.X, y=state.mother.y - 11, vx=0) window.camera.X0 = state.you.X window.camera.y0 = state.you.y state.ships.append(state.you) clearfull() populatefull() sound.play("longteleport") control.clear() dialog.play("convo5") background.wash() background.drawwash() if settings.saveonemergency: state.save()
def init(): global tplay window.camera.X0 = 0 window.camera.y0 = 500 window.camera.R = window.sy / 40 sound.epicness = 2 dialog.play("convo16") tplay = 0 background.wash() state.you = getattr(thing, quest.quests["Finale"].winner)(X=0, y=window.camera.y0 + 20) state.effects = []
def settarget(self): if self.progress > 1: sound.play("yes") if self.progress == 1: hud.show("Use arrow keys or WASD to move.") dialog.play("intro1") elif self.progress == 2: hud.clear() elif self.progress == 4: hud.show("Hold space (or enter, shift, or Z) and use arrows to teleport between ships.") dialog.play("intro2") elif self.progress == 5: hud.clear() elif self.progress == 6: dialog.play("intro3") elif self.progress == 10: dialog.play("intro4") if self.progress in (1, 2, 3, 5, 6, 8): dx, dy = self.tps[self.progress] state.target = thing.Target(X = dx / window.camera.y0, y = window.camera.y0 - dy) state.effects.append(state.target) elif self.progress in (4, 7, 9): state.target = None # better chance of getting something not obscured by the HUD if self.progress == 4: state.target = state.ships[-1] while state.target in (None, state.you): state.target = random.choice(state.ships) state.effects.append(thing.ShipTarget(parentid = state.target.thingid))
def settarget(self): if self.progress > 1: sound.play("yes") if self.progress == 1: hud.show("Use arrow keys or WASD to move.") dialog.play("intro1") elif self.progress == 2: hud.clear() elif self.progress == 4: hud.show("Hold space (or enter, shift, or Z) and use arrows to teleport between ships.") dialog.play("intro2") elif self.progress == 5: hud.clear() elif self.progress == 6: dialog.play("intro3") elif self.progress == 10: dialog.play("intro4") if self.progress in (1, 2, 3, 5, 6, 8): dx, dy = self.tps[self.progress] state.target = thing.Target(X=dx / window.camera.y0, y=window.camera.y0 - dy) state.effects.append(state.target) elif self.progress in (4, 7, 9): state.target = None # better chance of getting something not obscured by the HUD if self.progress == 4: state.target = state.ships[-1] while state.target in (None, state.you): state.target = random.choice(state.ships) state.effects.append(thing.ShipTarget(parentid=state.target.thingid))
def init(): global tplay, tspawn window.camera.X0 = 0 window.camera.y0 = 500 window.camera.R = window.sy / 40 sound.epicness = 2 dialog.play("finale") tplay = 0 background.wash() state.you = getattr(thing, quest.quests["Finale"].winner)(X = 0, y = window.camera.y0 + 20) state.effects = [] frange = lambda x, y, a = 1.0: [n * a for n in range(int(x / a), int(y / a))] tspawn = frange(12, 30, 2) + frange(14.5, 30, 1.11) + frange(19.27, 30, 0.28) tspawn.sort()
def think(self, dt): if self.done or not self.available: return self.t += dt if not self.cutscened: if self.t > 15 and dialog.tquiet > 15: self.cutscened = True from src.scenes import act2cutscene from src import scene scene.current = act2cutscene scene.toinit = act2cutscene if self.progress == 0 and thing.get(self.goal).isvisible(): dialog.play("convo10") self.progress = 1 if self.progress == 1 and self.cutscened: self.done = True quests["Seek"].setup()
def init(): global tplay, tspawn window.camera.X0 = 0 window.camera.y0 = 500 window.camera.R = window.sy / 40 sound.epicness = 2 dialog.play("finale") tplay = 0 background.wash() state.you = getattr(thing, quest.quests["Finale"].winner)(X=0, y=window.camera.y0 + 20) state.effects = [] frange = lambda x, y, a=1.0: [n * a for n in range(int(x / a), int(y / a))] tspawn = frange(12, 30, 2) + frange(14.5, 30, 1.11) + frange( 19.27, 30, 0.28) tspawn.sort()
def think(self, dt): if self.done or not self.available: return self.t += dt nvis = sum(convergence.isvisible() for convergence in state.convergences) if nvis > self.progress: self.chooserandomgoal() self.updateprogress(nvis) if self.progress == 1: dialog.play("convo13") if self.progress == 0 and dialog.tquiet > 10: dialog.play("convo11") if self.progress >= 1 and dialog.tquiet > 11: dialog.play("convo12") if self.progress >= 2 and dialog.tquiet > 12: dialog.play("echo1") if self.progress >= 3 and dialog.tquiet > 13: dialog.play("echo2") if self.progress >= 3 and dialog.tquiet > 60: dialog.play("echo3") dialog.play("echo4") if self.progress >= 4 and dialog.tquiet > 15: dialog.play("echo5") if self.progress >= 5 and dialog.tquiet > 16 and "convo14" in dialog.played: dialog.play("convo15") quests["Finale"].setup() if state.you.y - state.Rcore < 30 and dialog.tquiet > 10: dialog.play("convo14")
def think(dt, events, kpressed): global todraw, tplay hud.think(dt) quest.think(dt) dialog.think(dt) background.think(dt) sound.think(dt) if playing: tplay += dt background.flowt += dt * 4 if tplay > 3: dialog.play("convo9") if tplay > 6: background.wash() from src import scene from src.scenes import play scene.current = play state.you.tflash = settings.tcutsceneinvulnerability return nbubble = int(dt * 30) + (random.random() < dt * 30 % 1) for _ in range(nbubble): X = random.gauss(state.you.X, 30 / state.you.y) y = random.gauss(state.you.y, 30) if y < state.R - 10: state.effects.append(thing.Bubble(X = X, y = y)) todraw = [] scollide = [] hcollide = [] nships = [] for ship in state.ships: if not window.camera.near(ship): nships.append(ship) continue ship.think(dt) if ship.alive: nships.append(ship) if window.camera.on(ship): todraw.append(ship) else: ship.die() if ship is state.you: regenerate() state.ships = nships nobjs = [] for obj in state.objs: if not window.camera.on(obj): nobjs.append(obj) continue obj.think(dt) if obj.alive: nobjs.append(obj) todraw.append(obj) else: obj.die() state.obj = nobjs for hazard in state.hazards: if not window.camera.near(hazard): continue hazard.think(dt) todraw.append(hazard) if window.camera.on(hazard): hcollide.append(hazard) state.obj = nobjs neffects = [] for effect in state.effects: effect.think(dt) if effect.alive: todraw.append(effect) neffects.append(effect) else: effect.die() state.effects = neffects window.camera.follow(state.you) window.camera.think(dt)
def think(self, dt): if self.done or not self.available: return self.t += dt inmapper = isinstance(state.you, thing.Mapper) showingmap = inmapper and state.you.deployed if self.progress == 0: self.progress = 1 payloads = [ thing.Payload(pos = pos) for pos in state.worlddata["payloads"][:3] ] state.objs.extend(payloads) state.goals.extend(payloads) self.goals = [p.thingid for p in payloads] if self.progress == 1 and self.t > 2: dialog.play("start1") if self.progress == 1 and self.t > 3 and dialog.tquiet and not inmapper: mappers = [ship for ship in state.ships if isinstance(ship, thing.Mapper)] nearestid = min(mappers, key = lambda obj: window.distance(obj, state.you)).thingid if mappers else None if not self.mappertargetid or thing.get(self.mappertargetid).parentid != nearestid: if self.mappertargetid: thing.get(self.mappertargetid).die() if nearestid: mappertarget = thing.ShipTarget(parentid = nearestid) state.effects.append(mappertarget) self.mappertargetid = mappertarget.thingid if self.progress > 1 and self.mappertargetid: if thing.get(self.mappertargetid): thing.get(self.mappertargetid).die() self.mappertargetid = None if self.progress == 1 and inmapper: self.progress = 2 dialog.play("start2") if self.progress == 2 and showingmap: self.progress = 3 if self.progress == 3 and not showingmap and dialog.tquiet > 5: dialog.play("start3") if self.progress >= 1: if any(window.distance(thing.get(goal), state.you) < 20 for goal in self.goals): dialog.play("convo3") self.progress = 4 if self.progress >= 4: nvisible = sum(thing.get(goal).isvisible() for goal in self.goals) if self.progress == 4 and nvisible >= 1: dialog.play("convo4") self.progress = 5 if self.progress == 5 and nvisible >= 2: dialog.play("convo7") self.progress = 6 if self.progress == 6 and nvisible == 3: dialog.play("convo8") self.progress = 7 self.done = True quests["Act2"].setup() if not self.distressed and state.you.y < 270: dialog.play("distress")
from __future__ import division import pygame, math, sys, os.path, json, random from pygame.locals import * sys.path.insert(1, sys.path[0] + "/..") from src import ptext, dialog pygame.mixer.init() clock = pygame.time.Clock() toplay = list(dialog.lines) dialog.sound.init() while toplay: dt = clock.tick(60) * 0.001 dialog.think(dt) if not dialog.queue and not dialog.sound.lineplaying(): convo = toplay.pop(0) print print convo for line in dialog.lines[convo]: print line dialog.play(convo)
def think(dt, events, kpressed): global todraw, tplay hud.think(dt) quest.think(dt) dialog.think(dt) background.think(dt) sound.think(dt) if playing: tplay += dt background.flowt += dt * 4 if tplay > 3: dialog.play("convo9") if tplay > 6: background.wash() from src import scene from src.scenes import play scene.current = play state.you.tflash = settings.tcutsceneinvulnerability return nbubble = int(dt * 30) + (random.random() < dt * 30 % 1) for _ in range(nbubble): X = random.gauss(state.you.X, 30 / state.you.y) y = random.gauss(state.you.y, 30) if y < state.R - 10: state.effects.append(thing.Bubble(X=X, y=y)) todraw = [] scollide = [] hcollide = [] nships = [] for ship in state.ships: if not window.camera.near(ship): nships.append(ship) continue ship.think(dt) if ship.alive: nships.append(ship) if window.camera.on(ship): todraw.append(ship) else: ship.die() if ship is state.you: regenerate() state.ships = nships nobjs = [] for obj in state.objs: if not window.camera.on(obj): nobjs.append(obj) continue obj.think(dt) if obj.alive: nobjs.append(obj) todraw.append(obj) else: obj.die() state.obj = nobjs for hazard in state.hazards: if not window.camera.near(hazard): continue hazard.think(dt) todraw.append(hazard) if window.camera.on(hazard): hcollide.append(hazard) state.obj = nobjs neffects = [] for effect in state.effects: effect.think(dt) if effect.alive: todraw.append(effect) neffects.append(effect) else: effect.die() state.effects = neffects window.camera.follow(state.you) window.camera.think(dt)
def think(self, dt): if self.done or not self.available: return self.t += dt inmapper = isinstance(state.you, thing.Mapper) showingmap = inmapper and state.you.deployed if self.progress == 0: self.progress = 1 payloads = [thing.Payload(pos=pos) for pos in state.worlddata["payloads"][:3]] state.objs.extend(payloads) state.goals.extend(payloads) self.goals = [p.thingid for p in payloads] if self.progress == 1 and self.t > 2: dialog.play("start1") if self.progress == 1 and self.t > 3 and dialog.tquiet and not inmapper: mappers = [ship for ship in state.ships if isinstance(ship, thing.Mapper)] nearestid = min(mappers, key=lambda obj: window.distance(obj, state.you)).thingid if mappers else None if not self.mappertargetid or thing.get(self.mappertargetid).parentid != nearestid: if self.mappertargetid: thing.get(self.mappertargetid).die() if nearestid: mappertarget = thing.ShipTarget(parentid=nearestid) state.effects.append(mappertarget) self.mappertargetid = mappertarget.thingid if self.progress > 1 and self.mappertargetid: if thing.get(self.mappertargetid): thing.get(self.mappertargetid).die() self.mappertargetid = None if self.progress == 1 and inmapper: self.progress = 2 dialog.play("start2") if self.progress == 2 and showingmap: self.progress = 3 if self.progress == 3 and not showingmap and dialog.tquiet > 5: dialog.play("start3") if self.progress >= 1: if any(window.distance(thing.get(goal), state.you) < 20 for goal in self.goals): dialog.play("convo3") self.progress = 4 if self.progress >= 4: nvisible = sum(thing.get(goal).isvisible() for goal in self.goals) if self.progress == 4 and nvisible >= 1: dialog.play("convo4") self.progress = 5 if self.progress == 5 and nvisible >= 2: dialog.play("convo7") self.progress = 6 if self.progress == 6 and nvisible == 3: dialog.play("convo8") self.progress = 7 self.done = True quests["Act2"].setup() if not self.distressed and state.you.y < 270: dialog.play("distress")
def think(self, dt): if self.done or not self.available: return self.t += dt if self.progress == 0 and self.t > 1: dialog.play("convo2") self.progress = 1 payloads = [ thing.Payload(pos = pos) for pos in state.worlddata["payloads"][:3] ] state.objs.extend(payloads) state.goals.extend(payloads) self.goals = [p.thingid for p in payloads] if self.progress == 1: if any(window.distance(thing.get(goal), state.you) < 20 for goal in self.goals): dialog.play("convo3") self.progress = 2 if self.progress >= 2: nvisible = sum(thing.get(goal).isvisible() for goal in self.goals) if self.progress == 2 and nvisible >= 1: dialog.play("convo4") self.progress = 3 if self.progress == 3 and nvisible >= 2: dialog.play("convo7") self.progress = 4 if self.progress == 4 and nvisible == 3: dialog.play("convo8") self.progress = 5 self.done = True quests["Act2"].setup() if not self.distressed and state.you.y < 270: dialog.play("distress")