~vbkaisetsu/+junk/renpy-vertical-text

« back to all changes in this revision

Viewing changes to extras/dse/main.rpy

  • Committer: tom
  • Date: 2006-10-01 14:09:56 UTC
  • Revision ID: svn-v3-trunk1:a20cb6e2-ff0c-0410-a951-e6c088e16c52:renpy%2Ftrunk:148

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# This is the main program. This can be changed quite a bit to
2
 
# customize it for your program... But remember what you do, so you
3
 
# can integrate with a new version of DSE when it comes out.
4
 
 
5
 
# Declare black, so we can use it in the game,
6
 
init:
7
 
    image black = Solid((0, 0, 0, 255))
8
 
 
9
 
# This is the entry point into the game.
10
 
label start:
11
 
 
12
 
    # Required to initialize the event engine.
13
 
    call events_init from _call_events_init_1
14
 
 
15
 
    # Initialize the default values of some of the variables used in
16
 
    # the game.
17
 
    $ day = 0
18
 
 
19
 
    # Initialize the statistics used by the game.
20
 
    $ strength = Stat('Strength', 10, 100)
21
 
    $ intelligence = Stat('Intelligence', 10, 100)
22
 
 
23
 
    # Pick the stats to show to the user.
24
 
    $ shown_stats = [ strength, intelligence ]
25
 
 
26
 
    # Show a default background.
27
 
    scene black
28
 
 
29
 
    # The script here is run before any event.
30
 
 
31
 
    "In case you're just tuning in, here's the story of my life to
32
 
     date."
33
 
 
34
 
    "I'm a guy in the second year of high school."
35
 
 
36
 
    "I'm not good at sports or school or even something as simple as
37
 
     remembering peoples names."
38
 
 
39
 
    "In short, I am your usual random loser guy."
40
 
 
41
 
    "And this is my story..."
42
 
 
43
 
 
44
 
    # We jump to day to start the first day.
45
 
    jump day
46
 
 
47
 
 
48
 
# This is the label that is jumped to at the start of a day.
49
 
label day:
50
 
 
51
 
    # Increment the day it is.
52
 
    $ day += 1
53
 
 
54
 
    # We may also want to compute the name for the day here, but
55
 
    # right now we don't bother.
56
 
 
57
 
    "It's day %(day)d."
58
 
 
59
 
    # Here, we want to set up some of the default values for the
60
 
    # day planner. In a more complicated game, we would probably
61
 
    # want to add and remove choices from the dp_ variables
62
 
    # (especially dp_period_acts) to reflect the choices the
63
 
    # user has available to him.
64
 
 
65
 
    $ morning_act = None
66
 
    $ afternoon_act = None
67
 
    $ evening_act = None
68
 
 
69
 
    # Now, we call the day planner, which may set the act variables
70
 
    # to new values. 
71
 
    call day_planner from _call_day_planner_1
72
 
 
73
 
 
74
 
    # We process each of the three periods of the day, in turn.
75
 
label morning:
76
 
 
77
 
    # Tell the user what period it is.
78
 
    centered "Morning"
79
 
 
80
 
    # Set these variables to appropriate values, so they can be
81
 
    # picked up by the expression in the various events defined below. 
82
 
    $ period = "morning"
83
 
    $ act = morning_act
84
 
 
85
 
    # Execute the events for the morning.
86
 
    call events_run_period from _call_events_run_period_1
87
 
 
88
 
    # That's it for the morning, so we fall through to the
89
 
    # afternoon.
90
 
 
91
 
label afternoon:
92
 
 
93
 
    # It's possible that we will be skipping the afternoon, if one
94
 
    # of the events in the morning jumped to skip_next_period. If
95
 
    # so, we should skip the afternoon.
96
 
    if check_skip_period():
97
 
        jump evening
98
 
 
99
 
    # The rest of this is the same as for the morning.
100
 
 
101
 
    centered "Afternoon"
102
 
 
103
 
    $ period = "afternoon"
104
 
    $ act = afternoon_act
105
 
 
106
 
    call events_run_period from _call_events_run_period_2
107
 
 
108
 
 
109
 
label evening:
110
 
    
111
 
    # The evening is the same as the afternoon.
112
 
    if check_skip_period():
113
 
        jump night
114
 
 
115
 
    centered "Evening"
116
 
 
117
 
    $ period = "evening"
118
 
    $ act = evening_act
119
 
 
120
 
    call events_run_period from _call_events_run_period_3
121
 
 
122
 
 
123
 
label night:
124
 
 
125
 
    # This is now the end of the day, and not a period in which
126
 
    # events can be run. We put some boilerplate end-of-day text
127
 
    # in here.
128
 
 
129
 
    centered "Night"
130
 
 
131
 
    "It's getting late, so I decide to go to sleep."
132
 
 
133
 
    # We call events_end_day to let it know that the day is done.
134
 
    call events_end_day from _call_events_end_day_1
135
 
 
136
 
    # And we jump back to day to start the next day. This goes
137
 
    # on forever, until an event ends the game.
138
 
    jump day
139
 
         
140
 
 
141
 
# This is a callback that is called by the day planner. One of the
142
 
# uses of this is to show the statistics to the user.
143
 
 
144
 
label dp_callback:
145
 
 
146
 
    # Add in a line of dialogue asking the question that's on
147
 
    # everybody's mind.
148
 
    $ narrator("What should I do today?", interact=False)
149
 
 
150
 
    call stats_show from call_stats_show_1
151
 
 
152
 
    return
153