Exemplo n.º 1
0
def think(dt, events, kpressed):
    global t, Rfactor
    t += dt

    hud.think(dt)
    quest.think(dt)
    dialog.think(dt)
    background.think(dt, 4)

    for event in (events or []):
        if event.type == KEYUP and event.key == "go" and t > 8:
            scene.current = play
            scene.toinit = play
            background.wash()

    for ship in state.ships:
        ship.think(dt)
    for effect in state.effects:
        effect.think(dt)
    state.effects = [e for e in state.effects if e.alive]

    dt = min(dt, 0.1)
    window.camera.X0 = 0
    factor = 0.003 * t**3
    window.camera.y0 += (1 - math.exp(-factor * dt)) * (R - 80 -
                                                        window.camera.y0)

    factor = 0.3 + 0.1 * t**2
    Rfactor += (1 - math.exp(-factor * dt)) * (1 / 1600 - Rfactor)
    window.camera.R = window.sy * Rfactor
Exemplo n.º 2
0
def think(dt, events, kpressed):
	global t, Rfactor
	t += dt

	hud.think(dt)
	quest.think(dt)
	dialog.think(dt)
	background.think(dt, 4)

	for event in (events or []):
		if event.type == KEYUP and event.key == "go" and t > 8:
			scene.current = play
			scene.toinit = play
			background.wash()
		
	for ship in state.ships:
		ship.think(dt)
	for effect in state.effects:
		effect.think(dt)
	state.effects = [e for e in state.effects if e.alive]


	dt = min(dt, 0.1)
	window.camera.X0 = 0
	factor = 0.003 * t ** 3
	window.camera.y0 += (1 - math.exp(-factor * dt)) * (R - 80 - window.camera.y0)
	
	factor = 0.3 + 0.1 * t ** 2
	Rfactor += (1 - math.exp(-factor * dt)) * (1 / 1600 - Rfactor)
	window.camera.R = window.sy * Rfactor
Exemplo n.º 3
0
def init():
	global t
	t = 0
	window.camera.X0 = 0
	window.camera.R = window.sy / 200
	window.camera.y0 = state.R - 300 / 16
	sound.playtitlemusic()
	background.wash()
Exemplo n.º 4
0
def init():
    global t
    t = 0
    window.camera.X0 = 0
    window.camera.R = window.sy / 200
    window.camera.y0 = state.R - 300 / 16
    sound.playtitlemusic()
    background.wash()
Exemplo n.º 5
0
def endregenerate():
    state.you = thing.get(state.you.targetid)
    window.camera.X0 = state.you.X
    window.camera.y0 = state.you.y
    clearfull()
    populatefull()
    background.wash()
    background.drawwash()
    if settings.saveonemergency:
        state.save()
Exemplo n.º 6
0
def endregenerate():
	state.you = thing.get(state.you.targetid)
	window.camera.X0 = state.you.X
	window.camera.y0 = state.you.y
	clearfull()
	populatefull()
	background.wash()
	background.drawwash()
	if settings.saveonemergency:
		state.save()
Exemplo n.º 7
0
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 = []
Exemplo n.º 8
0
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()
Exemplo n.º 9
0
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 = []
Exemplo n.º 10
0
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()
Exemplo n.º 11
0
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()
Exemplo n.º 12
0
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()
Exemplo n.º 13
0
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
Exemplo n.º 14
0
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
			if event.type in (KEYDOWN, KEYUP):
Exemplo n.º 15
0
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)
Exemplo n.º 16
0
	def die(self):
		from src.scenes import act2cutscene
		act2cutscene.playing = True
		background.wash()
Exemplo n.º 17
0
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)