1 |
with (other) |
2 |
{ |
3 |
if (keyboard_multicheck_pressed(0) && scr_interactscr_interactfunction scr_interact() //gml_Script_scr_interact
{
if (distance_to_object(obj_pl) < 20 && obj_pl.state == gml_Script_scr_normal_state)
{
var pl_dir = obj_pl.direction
var pl_x = 0
var pl_y = 0
var check_distance_x = 0
var check_distance_y = 0
switch pl_dir
{
case 0:
pl_x = obj_pl.bbox_right
pl_y = obj_pl.bbox_top + 1
check_distance_x = 20
break
case 180:
pl_x = obj_pl.bbox_left
pl_y = obj_pl.bbox_top + 1
check_distance_x = -20
break
case 90:
pl_x = obj_pl.x
pl_y = obj_pl.bbox_top
check_distance_y = -20
break
case 270:
pl_x = obj_pl.x
pl_y = obj_pl.bbox_bottom
check_distance_y = 20
break
}
if collision_line_first(pl_x, pl_y, (pl_x + check_distance_x), (pl_y + check_distance_y), id, false, false)
return true;
}
} ()) |
4 |
scene = 1 |
5 |
switch scene |
6 |
{ |
7 |
case 1: |
8 |
scr_textscr_textfunction scr_text() //gml_Script_scr_text
{
if (!instance_exists(obj_dialogue))
msg = instance_create(x, y, obj_dialogue)
} () |
9 |
if (global.flag[0 Lemonade collected] == 0) |
10 |
{ |
11 |
with (msg) |
12 |
{ |
13 |
dialogue_is_minishop = true |
14 |
message[0] = "* (According to the price list,# it's a lemonade stand: 5g a# glass.)" |
15 |
message[1] = "* (Take some?)" |
16 |
ch_msg = 1 |
17 |
ch[1] = "Yes" |
18 |
ch[2] = "No" |
19 |
if (outcome == 1) |
20 |
{ |
21 |
message[2] = "* (You pour yourself a glass but# there is no attendant to take# your money. What poor service.)" |
22 |
message[3] = "* (Leave a tip?)" |
23 |
scr_itemscr_itemfunction scr_item(argument0) //gml_Script_scr_item
{
nm = argument0
var i = 1
while (i <= 8)
{
if (global.item_slot[i] == "Nothing")
{
global.item_slot[i] = nm
return true;
}
else
{
if (i == 8)
return false;
i++
continue
}
}
} ("Lemonade") |
24 |
global.flag[0 Lemonade collected] = 1 |
25 |
other.image_index = 1 |
26 |
other.scene++ |
27 |
} |
28 |
if (outcome == 2) |
29 |
global.dialogue_open = false |
30 |
} |
31 |
} |
32 |
else |
33 |
{ |
34 |
with (msg) |
35 |
{ |
36 |
dialogue_is_minishop = true |
37 |
message[0] = "* (There's no lemonade left.)" |
38 |
} |
39 |
} |
40 |
break |
41 |
case 2: |
42 |
with (msg) |
43 |
{ |
44 |
dialogue_is_minishop = true |
45 |
ch_msg = 3 |
46 |
ch[1] = "Yes" |
47 |
ch[2] = "No" |
48 |
if (outcome == 1) |
49 |
{ |
50 |
message[4] = "* (How much?)" |
51 |
other.scene++ |
52 |
} |
53 |
if (outcome == 2) |
54 |
global.dialogue_open = false |
55 |
} |
56 |
break |
57 |
case 3: |
58 |
with (msg) |
59 |
{ |
60 |
dialogue_is_minishop = true |
61 |
ch_msg = 4 |
62 |
ch[1] = "Large\nAmount" |
63 |
ch[2] = "Small\nAmount" |
64 |
if (outcome == 1) |
65 |
{ |
66 |
if (global.player_gold > 5) |
67 |
{ |
68 |
global.player_gold -= 5 |
69 |
message[5] = "* (You leave 5g in the tip jar.# Your conscience feels light as# a feather.)" |
70 |
} |
71 |
else if (global.player_gold < 5 && global.player_gold > 0) |
72 |
{ |
73 |
global.player_gold -= global.player_gold |
74 |
message[5] = "* (You leave all you have in the# tip jar.)" |
75 |
} |
76 |
else if (global.player_gold <= 0) |
77 |
message[5] = "* (You have no gold.)" |
78 |
other.scene++ |
79 |
} |
80 |
if (outcome == 2) |
81 |
{ |
82 |
if (global.player_gold >= 1) |
83 |
{ |
84 |
global.player_gold -= 1 |
85 |
message[5] = "* (You break a coin in half and# debate which half to throw in# before tossing one at random.)" |
86 |
message[6] = "* (They are both worthless anyway# so it doesn't really matter.)" |
87 |
} |
88 |
else if (global.player_gold <= 0) |
89 |
message[5] = "* (You have no gold.)" |
90 |
other.scene++ |
91 |
} |
92 |
} |
93 |
break |
94 |
} |
95 |
|
96 |
if (!global.dialogue_open) |
97 |
scene = 0 |
98 |
} |