-
Notifications
You must be signed in to change notification settings - Fork 7
/
spiced.chai
626 lines (535 loc) · 24 KB
/
spiced.chai
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
dump_system();
class Travel_To {
def Travel_To(string t_name, int t_cost, int t_x, int t_y, bool t_requires_offroad_tires, bool t_requires_chains) {
this.name = t_name;
this.cost = t_cost;
this.x = t_x;
this.y = t_y;
this.requires_offroad_tires = t_requires_offroad_tires;
this.requires_chains = t_requires_chains;
}
var name;
var cost;
var x;
var y;
var requires_offroad_tires;
var requires_chains;
}
def refusing_business(t_game) {
return t_game.get_flag("deborah_shared_verse") && t_game.get_flag("have_spread_rumors") && !t_game.get_flag("have_said_something_nice") && !t_game.get_flag("did_not_respond");
}
def did_make_all_responses(Game t_game) {
return t_game.get_flag("have_talked_to_Diane") && t_game.get_flag("have_talked_to_Joshua");
}
def did_make_all_responses(Game_State t_game_state) {
return did_make_all_responses(t_game_state.game());
}
def have_said_something_nice(t_game) {
return t_game.game().get_flag("have_said_something_nice")
}
def travel_to(t_loc, t_game_state) {
var has_offroad_tires = t_game_state.game().get_flag("has_offroad_tires");
var has_tire_chains = t_game_state.game().get_flag("has_tire_chains");
var no_chains = !has_tire_chains && t_loc.requires_chains;
var no_offroad_tires = !has_offroad_tires && t_loc.requires_offroad_tires;
if (no_chains && no_offroad_tires) {
t_game_state.game().show_message_box("This route requires tire chains and off-road tires.");
} else if (no_chains) {
t_game_state.game().show_message_box("This route requires tire chains.");
} else if (no_offroad_tires) {
t_game_state.game().show_message_box("This route requires off-road tires.");
} else {
if (do_purchase(t_game_state.game(), t_loc.cost)) {
t_game_state.game().teleport_to_tile(t_loc.x, t_loc.y);
}
}
}
def sell(string t_thing, int t_price, t_game_state, t_bread, t_meat, t_vegetables, t_wood, t_next)
{
var count = t_game_state.game().get_value(t_thing);
if (count > 0) {
t_game_state.game().set_value(t_thing, count - 1);
t_game_state.game().set_value("money", t_game_state.game().get_value("money") + t_price);
} else {
t_game_state.game().show_message_box("You don't have any ${t_thing} to sell.");
}
show_shop_menu(t_game_state, false, t_bread, t_meat, t_vegetables, t_wood, t_next);
}
def do_purchase(t_game, int t_price)
{
var money = t_game.get_value("money");
if (money >= t_price) {
t_game.set_value("money", money-t_price);
return true;
} else {
t_game.show_message_box("You don't have enough cash");
return false;
}
}
def buy(string t_thing, int t_price, t_game_state, t_bread, t_meat, t_vegetables, t_wood, t_next)
{
var total_items = t_game_state.game().get_value("meat") + t_game_state.game().get_value("wood") + t_game_state.game().get_value("vegetables") + t_game_state.game().get_value("bread");
if (total_items == 5) {
t_game_state.game().show_message_box("Your truck is full.");
} else {
var money = t_game_state.game().get_value("money");
if (do_purchase(t_game_state.game(), t_price)) {
var count = t_game_state.game().get_value(t_thing);
t_game_state.game().set_value(t_thing, count + 1);
}
}
show_shop_menu(t_game_state, false, t_bread, t_meat, t_vegetables, t_wood, t_next);
}
def show_shop_menu(t_game_state, t_sensitive, int t_bread, int t_meat, int t_vegetables, int t_wood)
{
show_shop_menu(t_game_state, t_sensitive, t_bread, t_meat, t_vegetables, t_wood, 0);
}
def show_shop_menu(t_game_state, t_sensitive, int t_bread, int t_meat, int t_vegetables, int t_wood, int t_next)
{
var bread = t_game_state.game().get_value("bread");
var meat = t_game_state.game().get_value("meat");
var vegetables = t_game_state.game().get_value("vegetables");
var wood = t_game_state.game().get_value("wood");
var money = t_game_state.game().get_value("money");
if (t_sensitive && refusing_business(t_game_state.game())) {
t_game_state.game().show_message_box("This location is refusing to do business with you because of your rumor spreading");
return;
}
var actions =
[
Game_Action("Sell Bread $${t_bread} (have: ${bread})",
fun[t_bread, t_meat, t_vegetables, t_wood](t_game_state){
sell("bread", t_bread, t_game_state, t_bread, t_meat, t_vegetables, t_wood, 0);
}),
Game_Action("Sell Meat $${t_meat} (have: ${meat})",
fun[t_bread, t_meat, t_vegetables, t_wood](t_game_state){
sell("meat", t_meat, t_game_state, t_bread, t_meat, t_vegetables, t_wood, 1);
}),
Game_Action("Sell Vegetables $${t_vegetables} (have: ${vegetables})",
fun[t_bread, t_meat, t_vegetables, t_wood](t_game_state){
sell("vegetables", t_vegetables, t_game_state, t_bread, t_meat, t_vegetables, t_wood, 2);
}),
Game_Action("Sell Wood $${t_wood} (have: ${wood})",
fun[t_bread, t_meat, t_vegetables, t_wood](t_game_state){
sell("wood", t_wood, t_game_state, t_bread, t_meat, t_vegetables, t_wood, 3);
}),
Game_Action("Buy Bread $${t_bread} (have: ${bread})",
fun[t_bread, t_meat, t_vegetables, t_wood](t_game_state){
buy("bread", t_bread, t_game_state, t_bread, t_meat, t_vegetables, t_wood, 4);
}),
Game_Action("Buy Meat $${t_meat} (have: ${meat})",
fun[t_bread, t_meat, t_vegetables, t_wood](t_game_state){
buy("meat", t_meat, t_game_state, t_bread, t_meat, t_vegetables, t_wood, 5);
}),
Game_Action("Buy Vegetables $${t_vegetables} (have: ${vegetables})",
fun[t_bread, t_meat, t_vegetables, t_wood](t_game_state){
buy("vegetables", t_vegetables, t_game_state, t_bread, t_meat, t_vegetables, t_wood, 6);
}),
Game_Action("Buy Wood $${t_wood} (have: ${wood})",
fun[t_bread, t_meat, t_vegetables, t_wood](t_game_state){
buy("wood", t_wood, t_game_state, t_bread, t_meat, t_vegetables, t_wood, 7);
}),
Game_Action("Buy tire chains ($150)",
fun[t_bread, t_meat, t_vegetables, t_wood](t_game_state){
if (!t_game_state.game().get_flag("has_tire_chains")) {
if (do_purchase(t_game_state.game(), 150)) {
t_game_state.game().set_flag("has_tire_chains", true);
}
} else {
t_game_state.game().show_message_box("You already own tire chains.");
}
show_shop_menu(t_game_state, false, t_bread, t_meat, t_vegetables, t_wood, 8);
}),
Game_Action("Buy off-road tires ($500)",
fun[t_bread, t_meat, t_vegetables, t_wood](t_game_state){
if (!t_game_state.game().get_flag("has_offroad_tires")) {
if (do_purchase(t_game_state.game(), 500)) {
t_game_state.game().set_flag("has_offroad_tires", true);
}
} else {
t_game_state.game().show_message_box("You already own off-road tires.");
}
show_shop_menu(t_game_state, false, t_bread, t_meat, t_vegetables, t_wood, 9);
}),
Game_Action("Done ($${money} avail) / (${meat+wood+vegetables+bread}/5 cargo)", fun(t_game_state) {})
];
t_game_state.game().show_selection_menu(t_game_state.state(), actions, t_next);
}
def make_signpost_actions(Vector t_locations) {
return fun[t_locations](t_game_state, t_obj)
{
var actions = [];
for(var i = 0; i < t_locations.size(); ++i) {
var loc = t_locations[i];
var cost = loc.cost;
var action_desc = "Travel to ${t_locations[i].name} $${t_locations[i].cost} "
if (i == 0) {
var money = t_game_state.game().get_value("money").to_string();
action_desc += " ($${money} avail)";
}
actions.push_back_ref(
Object_Action(action_desc,
fun[loc, cost](t_game_state, t_obj)
{
travel_to(loc, t_game_state);
}
)
);
}
actions.push_back_ref(Object_Action("Done", fun(t_game_state, t_obj){}));
return actions;
}
}
GLOBAL parser = Script_Parser();
// Game engine expects to eval this file and get back a function for populating a game with data.
// This is that function
var game_creator = fun(game) {
// create the tilemap from the level definition
var map = Tile_Map(game, "resources/Maps/worldmap.json", [Tile_Defaults(2, Tile_Properties(false))], parser);
var collision_action = fun(t_game_state, t_obj, t_collision)
{
t_obj.get_actions(t_game_state);
t_game_state.game().show_object_interaction_menu(t_game_state.state(), t_obj);
};
// Glenn Haven
map.set_collision_action("glennhaven_signpost", collision_action);
map.set_action_generator("glennhaven_signpost", make_signpost_actions(
[Travel_To("Fairview", 5, 12, 12, false, false),
Travel_To("Mineralville", 10, 12, 6, true, false)]));
map.set_collision_action("glennhaven",
fun(t_game_state, t_obj, t_sprite) {
t_game_state.game().enter_map("glennhaven");
}
);
var glennhaven = Tile_Map(game, "resources/Maps/glennhaven.json", [], parser);
glennhaven.add_enter_action(
fun(t_game) {
if (refusing_business(t_game)) {
t_game.show_message_box("We've decided to stop doing business with you because of your rumor spreading.");
}
t_game.teleport_to_tile(9, 4);
}
);
glennhaven.set_collision_action("ExitSquare",
fun(t_game_state, t_obj, t_sprite) {
t_game_state.game().enter_map("world");
t_game_state.game().teleport_to_tile(2,12);
}
);
var Joshua_conversation_tree =
Conversation([
Question("Hello",
[Answer("Joshua", "Hi! Welcome to Glenn Haven.\nI've just opened up shop here.\nI think you'll like our prices on bread!")]
),
Question("<spread rumors about competitor>",
[Answer("Joshua", "That's not a very nice thing to say...")],
fun(t_game_state){ t_game_state.game().get_flag("have_talked_to_deborah_about_rumors") && !t_game_state.game().get_flag("have_talked_to_Joshua"); },
fun(t_game_state){ t_game_state.game().set_flag("have_talked_to_Joshua", true); t_game_state.game().set_flag("have_spread_rumors", true); }
),
Question("<say something nice about competitor>",
[Answer("Joshua", "That's good to hear.")],
fun(t_game_state){ t_game_state.game().get_flag("have_talked_to_deborah_about_rumors") && !t_game_state.game().get_flag("have_talked_to_Joshua"); },
fun(t_game_state){ t_game_state.game().set_flag("have_talked_to_Joshua", true); t_game_state.game().set_flag("have_said_something_nice", true); }
),
Question("<say nothing about competitor>",
[],
fun(t_game_state){ t_game_state.game().get_flag("have_talked_to_deborah_about_rumors") && !t_game_state.game().get_flag("have_talked_to_Joshua"); },
fun(t_game_state){ t_game_state.game().set_flag("have_talked_to_Joshua", true); t_game_state.game().set_flag("did_not_respond", true); }
)
]);
var Joshua_actions = fun[Joshua_conversation_tree](t_game_state, t_obj){
return [
Object_Action("Look",
fun(t_game_state, t_obj)
{
t_game_state.game().show_message_box("The proprietor of this trading post");
}
),
Object_Action("Talk To",
fun[Joshua_conversation_tree](t_game_state, t_obj)
{
t_game_state.game().show_conversation(t_game_state.state(), t_obj, Joshua_conversation_tree);
}
),
Object_Action("Shop",
fun(t_game_state, t_obj){
show_shop_menu(t_game_state, true, 80, 112, 85, 100);
}
)
];
};
glennhaven.set_collision_action("Joshua", collision_action);
glennhaven.set_action_generator("Joshua", Joshua_actions);
game.add_map("glennhaven", glennhaven);
// Fairview
map.set_collision_action("fairview_signpost", collision_action);
map.set_action_generator("fairview_signpost", make_signpost_actions(
[Travel_To("Glenn Haven", 5, 3, 12, false, false),
Travel_To("Mineralville", 8, 12, 6, false, true)]));
map.set_collision_action("fairview",
fun(t_game_state, t_obj, t_sprite) {
t_game_state.game().enter_map("fairview");
}
);
var fairview = Tile_Map(game, "resources/Maps/fairview.json", [], parser);
fairview.add_enter_action(
fun(t_game) {
t_game.teleport_to_tile(1, 5);
}
);
fairview.set_collision_action("ExitSquare",
fun(t_game_state, t_obj, t_sprite) {
t_game_state.game().enter_map("world");
t_game_state.game().teleport_to_tile(13,12);
}
);
var Deborah_conversation_tree =
Conversation([
Question("Hello",
[Answer("Deborah", "Hi! Welcome to Fairview.")]
),
Question("Rumors",
[Answer("Deborah", "Yes, I've heard the rumors too."),
Answer("Deborah", "It's an unfortunate way to do business.")],
fun(t_game_state){ t_game_state.game().get_flag("have_been_notified_of_rumors"); }
),
Question("What should I do?",
[Answer("Deborah", "Don't retaliate. Rumor mongering is not the best way to do business.")],
fun(t_game_state){ t_game_state.game().get_flag("have_been_notified_of_rumors"); },
fun(t_game_state){ t_game_state.game().set_flag("have_talked_to_deborah_about_rumors", true); }
),
Question("What now?",
[Answer("Deborah", "Romans 12:19 says, 'Friends, do not avenge yourselves;\ninstead, leave room for His wrath.\nFor it is written: Vengeance belongs to Me;\nI will repay, says the Lord.'"),
Answer("Deborah", "I hope you didn't decide to take matters into your own hands.\nThat rarely works out well.")],
fun(t_game_state){ did_make_all_responses(t_game_state); },
fun(t_game_state){ t_game_state.game().set_flag("deborah_shared_verse", true); }
),
Question("Note",
[Answer("Deborah", "Romans 12:19 says, 'Friends, do not avenge yourselves;\ninstead, leave room for His wrath.\nFor it is written: Vengeance belongs to Me;\nI will repay, says the Lord.'"),
Answer("Deborah", "This you already know."),
Answer("Deborah", "Romans 12:20 goes on to say 'But If your enemy is hungry,\nfeed him. If he is thirsty, give him something to drink.\nFor in so doing\nyou will be heaping fiery coals on his head.'"),
Answer("Deborah", "This is the lesson you've learned today.")],
fun(t_game_state){ t_game_state.game().get_flag("saw_note") },
fun(t_game_state){ t_game_state.game().set_flag("deborah_shared_second_verse", true); }
)
]);
var Deborah_actions = fun[Deborah_conversation_tree](t_game_state, t_obj){
return [
Object_Action("Look",
fun(t_game_state, t_obj)
{
t_game_state.game().show_message_box("The proprietor of this trading post");
}
),
Object_Action("Talk To",
fun[Deborah_conversation_tree](t_game_state, t_obj)
{
t_game_state.game().show_conversation(t_game_state.state(), t_obj, Deborah_conversation_tree);
}
),
Object_Action("Shop",
fun(t_game_state, t_obj){
show_shop_menu(t_game_state, false, 95, 100, 85, 93);
}
)
];
};
fairview.set_collision_action("Deborah", collision_action);
fairview.set_action_generator("Deborah", Deborah_actions);
fairview.set_portrait("Deborah", "resources/Deborah-portrait.png");
game.add_map("fairview", fairview);
// Mineralville
map.set_collision_action("mineralville_signpost", collision_action);
map.set_action_generator("mineralville_signpost", make_signpost_actions(
[Travel_To("Glenn Haven", 10, 3, 12, true, false),
Travel_To("Fairview", 8, 12, 12, false, true),
Travel_To("Camp", 15, 8, 1, true, true)]));
map.set_collision_action("mineralville",
fun(t_game_state, t_obj, t_sprite) {
t_game_state.game().enter_map("mineralville");
}
);
var mineralville = Tile_Map(game, "resources/Maps/mineralville.json", [], parser);
var William_conversation_tree =
Conversation([
Question("Rumors",
[Answer("William", "You must be the new trader in town.\nYour competitor has been saying unflattering things about you."),
Answer("William", "But you seem like a nice person... I'm not sure I believe them.")],
fun(t_game_state){ !t_game_state.game().get_flag("have_been_notified_of_rumors"); },
fun(t_game_state){ t_game_state.game().set_flag("have_been_notified_of_rumors", true); }
),
Question("What should I do?",
[Answer("William", "Well, if it were me, I'd start spreading rumors of my own about them!\nYou have to fight for what you get.")],
fun(t_game_state){ t_game_state.game().get_flag("have_been_notified_of_rumors"); }
),
Question("Note?",
[Answer("William", "There's a note here from your competitor."),
Answer("William", "It says he's sorry for starting those rumors about you,\nand promises to set things right")],
fun(t_game_state) { !t_game_state.game().get_flag("saw_note") && did_make_all_responses(t_game_state) && have_said_something_nice(t_game_state.game()) && t_game_state.game().get_flag("deborah_shared_verse"); },
fun(t_game_state) { t_game_state.game().set_flag("saw_note", true); }
),
Question("Share bible verses you've learned.",
[Answer("William", "Well that is interesting...")],
fun(t_game_state) { t_game_state.game().get_flag("deborah_shared_second_verse") }
)
]);
mineralville.add_enter_action(
fun(t_game) {
t_game.teleport_to_tile(2, 5);
if (!t_game.get_flag("have_been_notified_of_rumors")) {
t_game.show_message_box("You see an old man who has the look of someone who has\nspent many years living in a remote\nmountain town.");
t_game.show_message_box("William: There's the person I've been hearing so much about!");
}
if (!t_game.get_flag("saw_note") && did_make_all_responses(t_game) && have_said_something_nice(t_game))
{
t_game.show_message_box("There's a note over here for you");
}
}
);
mineralville.set_collision_action("ExitSquare",
fun(t_game_state, t_obj, t_sprite) {
t_game_state.game().enter_map("world");
t_game_state.game().teleport_to_tile(14,5);
}
);
var William_actions = fun[William_conversation_tree](t_game_state, t_obj){
return [
Object_Action("Look",
fun(t_game_state, t_obj)
{
t_game_state.game().show_message_box("An older, somewhat worn looking man.");
}
),
Object_Action("Talk To",
fun[William_conversation_tree](t_game_state, t_obj)
{
t_game_state.game().show_conversation(t_game_state.state(), t_obj, William_conversation_tree);
}
),
Object_Action("Shop",
fun(t_game_state, t_obj){
show_shop_menu(t_game_state, false, 100, 125, 95, 70);
}
)
];
};
mineralville.set_collision_action("William", collision_action);
mineralville.set_action_generator("William", William_actions);
game.add_map("mineralville", mineralville);
// Camp
map.set_collision_action("camp_signpost", collision_action);
map.set_action_generator("camp_signpost", make_signpost_actions(
[Travel_To("Mineralville", 15, 12, 6, true, true)]));
map.set_collision_action("camp",
fun(t_game_state, t_obj, t_sprite) {
t_game_state.game().enter_map("camp");
}
);
var camp = Tile_Map(game, "resources/Maps/camp.json", [], parser);
camp.add_enter_action(
fun(t_game) {
if (refusing_business(t_game)) {
t_game.show_message_box("We've decided to stop doing business with you\nbecause of your rumor spreading.");
}
t_game.teleport_to_tile(9, 4);
}
);
camp.set_collision_action("ExitSquare",
fun(t_game_state, t_obj, t_sprite) {
t_game_state.game().enter_map("world");
t_game_state.game().teleport_to_tile(7,1);
}
);
var Twin_conversation_tree =
Conversation([
Question("Hello",
[Answer("Dana", "Hi! Welcome to the archaeological camp here."),
Answer("Diane", "The two of us are scientists evaluating the finds from the dig here."),
Answer("Diane", "We welcome any supplies you manage to get up here.")]
),
Question("You look a lot a like",
[Answer("Diane", "Yes, we are twins")]
),
Question("<spread rumors about competitor>",
[Answer("Diane", "That's not a very nice thing to say...")],
fun(t_game_state){ t_game_state.game().get_flag("have_talked_to_deborah_about_rumors") && !t_game_state.game().get_flag("have_talked_to_Diane"); },
fun(t_game_state){ t_game_state.game().set_flag("have_talked_to_Diane", true); t_game_state.game().set_flag("have_spread_rumors", true); }
),
Question("<say something nice about competitor>",
[Answer("Diane", "That's good to hear.")],
fun(t_game_state){ t_game_state.game().get_flag("have_talked_to_deborah_about_rumors") && !t_game_state.game().get_flag("have_talked_to_Diane"); },
fun(t_game_state){ t_game_state.game().set_flag("have_talked_to_Diane", true); t_game_state.game().set_flag("have_said_something_nice", true); }
),
Question("<say nothing about competitor>",
[],
fun(t_game_state){ t_game_state.game().get_flag("have_talked_to_deborah_about_rumors") && !t_game_state.game().get_flag("have_talked_to_Diane"); },
fun(t_game_state){ t_game_state.game().set_flag("have_talked_to_Diane", true); t_game_state.game().set_flag("did_not_respond", true); }
)
]);
def camp_shop(t_game_state, t_obj) {
show_shop_menu(t_game_state, true, 115, 147, 104, 84);
}
var Dana_actions = fun[Twin_conversation_tree](t_game_state, t_obj){
return [
Object_Action("Look",
fun(t_game_state, t_obj)
{
t_game_state.game().show_message_box("You see two women who look VERY similar.\nThey are approachable and friendly looking.");
}
),
Object_Action("Talk To",
fun[Twin_conversation_tree](t_game_state, t_obj)
{
t_game_state.game().show_conversation(t_game_state.state(), t_obj, Twin_conversation_tree);
}
),
Object_Action("Shop",
camp_shop
)
];
};
camp.set_collision_action("Dana", collision_action);
camp.set_action_generator("Dana", Dana_actions);
var Diane_actions = fun[Twin_conversation_tree](t_game_state, t_obj){
return [
Object_Action("Look",
fun(t_game_state, t_obj)
{
t_game_state.game().show_message_box("You see two women who look VERY similar.\nThey are approachable and friendly looking.");
}
),
Object_Action("Talk To",
fun[Twin_conversation_tree](t_game_state, t_obj)
{
t_game_state.game().show_conversation(t_game_state.state(), t_obj, Twin_conversation_tree);
}
),
Object_Action("Shop",
camp_shop
)
];
};
camp.set_collision_action("Diane", collision_action);
camp.set_action_generator("Diane", Diane_actions);
game.add_map("camp", camp);
game.add_map("world", map);
game.set_avatar(game.get_texture("resources/pinheads_marble.png"));
game.set_zoom(.5);
game.add_start_action(
fun(t_game) {
t_game.set_value("money", 250);
var money = t_game.get_value("money");
t_game.show_message_box("Welcome to the game!\nWe wish it had a name - but it doesn't.");
t_game.show_message_box("You are a trader of goods set in modern times.\nYou supply the various towns and camps with their material needs.");
t_game.show_message_box("Your choices have consequences.\nYou may want to play multiple times.");
t_game.show_message_box("To interact with characters and objects simply bump into them.\nAll input is via the arrow keys and enter key.");
t_game.show_message_box("Unfortunately we ran out of time for graphics.\nOur NPCs are pinheads.\n\nOur PC is a marble.\n\nOur modern world is a medieval fantasy world.");
t_game.show_message_box("You have $${money} to start with.\nUse it wisely.");
t_game.add_queued_action(
fun(t_game_state) {
t_game_state.game().enter_map("glennhaven");
}
);
}
);
}