forked from dragonfi/ld25-you-are-the-hero
/
script.py
81 lines (65 loc) · 1.9 KB
/
script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
from pyglet import clock
from random import randint
s = None
def start(scene):
print "start"
global s
s = scene
s.Title('You are the Hero', on_screen = True)
s.Narration('All the villagers said', on_screen = True)
s.Choice("I was eager", on_select = scene1, on_screen = True)
s.Choice("I wasn't eager", on_select = scene1, on_screen = True)
def scene1():
print "scene1"
s.Narration('Sending me into the snow-storm')
s.Narration('Without any help')
s.Narration('Again')
s.Narration('Alone')
clock.schedule_interval(spawn_troll, 5)
clock.schedule_once(scene2, 20)
def spawn_troll(dt):
s.Troll()
def scene2(dt):
print "scene2"
s.Narration('Why me?')
s.Narration('Alone')
s.Narration('Why me?')
s.Narration('Alone')
s.Narration('This is not fair')
clock.unschedule(spawn_troll)
clock.schedule_interval(spawn_troll, 3)
clock.schedule_once(scene3, 20)
def scene3(dt):
print "scene3"
clock.unschedule(spawn_troll)
clock.schedule_interval(spawn_troll, 2)
s.Choice("I had enough", on_select=pre_village)
def pre_village():
s.Narration("This time")
s.Narration("They will pay")
s.Narration("They will pay")
clock.schedule_once(village_scene, 20)
counter = 20
def decrement_counter():
global counter
counter -= 1
if counter <= 0:
ending()
def village_callback(dt):
s.House()
def village_scene(dt):
clock.unschedule(spawn_troll)
s.Narration("This time")
s.Narration("They will say")
s.Title("You are the Villain")
clock.schedule_interval(village_callback, 5)
for i in range(counter + 4):
s.Villager(on_death = decrement_counter)
def fade_out(dt):
s.fade_out()
def ending():
s.Title("But it was another village")
s.Title("But it was another village")
s.Narration("The end.")
s.Narration("The end.")
clock.schedule_once(fade_out, 10)