1 |
if (global.interact == 0 && uncan == 0) |
2 |
{ |
3 |
if (instance_exists(obj_itemswapper) == 0) |
4 |
{ |
5 |
if (global.facing == 1) |
6 |
{ |
7 |
if (collision_rectangle(x + (sprite_width / 2), y + 19, x + sprite_width + 15, y + sprite_height, obj_interactable, 0, 1)) |
8 |
{ |
9 |
interactedobject = collision_rectangle(x + (sprite_width / 2), y + (sprite_height / 2), x + sprite_width + 15, y + sprite_height, obj_interactable, 0, 1); |
10 |
if (interactedobject != -4) |
11 |
{ |
12 |
with (interactedobject) |
13 |
facing = 3; |
14 |
with (interactedobject) |
15 |
script_execute(scr_interact); |
16 |
} |
17 |
} |
18 |
} |
19 |
if (global.facing == 3) |
20 |
{ |
21 |
if (collision_rectangle(x + (sprite_width / 2), y + 19, x - 15, y + sprite_height, obj_interactable, 0, 1)) |
22 |
{ |
23 |
interactedobject = collision_rectangle(x + (sprite_width / 2), y + 3 + (sprite_height / 2), x - 15, y + sprite_height + 3, obj_interactable, 0, 1); |
24 |
if (interactedobject != -4) |
25 |
{ |
26 |
with (interactedobject) |
27 |
facing = 1; |
28 |
with (interactedobject) |
29 |
script_execute(scr_interact); |
30 |
} |
31 |
} |
32 |
} |
33 |
if (global.facing == 0) |
34 |
{ |
35 |
if (collision_rectangle(x + 4, y + 20, (x + sprite_width) - 4, y + sprite_height + 15, obj_interactable, 0, 1)) |
36 |
{ |
37 |
interactedobject = collision_rectangle(x + 4, y + 20, (x + sprite_width) - 4, y + sprite_height + 15, obj_interactable, 0, 1); |
38 |
if (interactedobject != -4) |
39 |
{ |
40 |
with (interactedobject) |
41 |
facing = 2; |
42 |
with (interactedobject) |
43 |
script_execute(scr_interact); |
44 |
} |
45 |
} |
46 |
} |
47 |
if (global.facing == 2) |
48 |
{ |
49 |
if (collision_rectangle(x + 4, (y + sprite_height) - 5, (x + sprite_width) - 4, y + 5, obj_interactable, 0, 1)) |
50 |
{ |
51 |
interactedobject = collision_rectangle(x + 4, (y + sprite_height) - 5, (x + sprite_width) - 4, y + 8, obj_interactable, 0, 1); |
52 |
if (interactedobject != -4) |
53 |
{ |
54 |
with (interactedobject) |
55 |
facing = 0; |
56 |
with (interactedobject) |
57 |
script_execute(scr_interact); |
58 |
} |
59 |
} |
60 |
} |
61 |
} |
62 |
} |