| 1 |
var robot_item_x_player = obj_pl.x; |
| 2 |
var robot_item_y_player = obj_pl.y - 9 - (sprite_height - sprite_yoffset); |
| 3 |
if (scr_interactscr_interactfunction scr_interact()
{
if (distance_to_object(obj_pl) < 20 && obj_pl.state == 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;
}
} () && keyboard_multicheck_pressed(0)) |
| 4 |
{ |
| 5 |
if (global.route == 2) |
| 6 |
{ |
| 7 |
if (robot_item_is_carried == false && robot_item_can_pickup == true) |
| 8 |
{ |
| 9 |
with (obj_robuild_parent) |
| 10 |
{ |
| 11 |
if (robot_item_is_carried == true) |
| 12 |
exit; |
| 13 |
} |
| 14 |
robot_item_is_jumping = true; |
| 15 |
robot_item_x_target = robot_item_x_player; |
| 16 |
robot_item_y_target = robot_item_y_player; |
| 17 |
audio_play_sound(snd_playerjump, 1, 0); |
| 18 |
depth = obj_pl.depth - 1; |
| 19 |
solid = false; |
| 20 |
visible = true; |
| 21 |
obj_pl.state = scr_frozen_state; |
| 22 |
obj_pl.image_index = 0; |
| 23 |
obj_pl.image_speed = 0; |
| 24 |
} |
| 25 |
} |
| 26 |
else |
| 27 |
{ |
| 28 |
scr_textscr_textfunction scr_text()
{
if (!instance_exists(obj_dialogue))
msg = instance_create(x, y, obj_dialogue);
} (); |
| 29 |
with (msg) |
| 30 |
message[0] = "* (Just some useless scrap.)"; |
| 31 |
} |
| 32 |
} |
| 33 |
if (robot_item_is_jumping == true) |
| 34 |
{ |
| 35 |
if (scr_arc_jumpscr_arc_jumpfunction scr_arc_jump(arg0, arg1)
{
var jump_target_x = arg0;
var jump_target_y = arg1;
var _xd = jump_target_x - x;
var _yd = jump_target_y - y;
if (_xd == 0)
_xd = 1;
gravity = 1.5;
var _hsp = (sign(_xd) * sqrt(abs(_xd))) / 1.5;
var _time = ceil(_xd / _hsp);
hspeed = _xd / _time;
vspeed = (_yd / _time) - ((gravity / 2) * (_time + 1));
alarm[0]
if (round(x) == jump_target_x && round(y) == jump_target_y)
{
hspeed = 0;
vspeed = 0;
x = jump_target_x;
y = jump_target_y;
gravity = 0;
return true;
}
return false;
} (robot_item_x_target, robot_item_y_target)) |
| 36 |
{ |
| 37 |
if (robot_item_is_carried == false) |
| 38 |
{ |
| 39 |
robot_item_is_carried = true; |
| 40 |
robot_item_is_jumping = false; |
| 41 |
if (!global.cutscene) |
| 42 |
scr_cutscene_end(); |
| 43 |
} |
| 44 |
else if (robot_item_is_carried == true) |
| 45 |
{ |
| 46 |
audio_play_sound(snd_mart_impact_2, 1, 0); |
| 47 |
robot_item_is_carried = false; |
| 48 |
robot_item_is_jumping = false; |
| 49 |
depth = -y; |
| 50 |
solid = true; |
| 51 |
visible = true; |
| 52 |
if (!instance_exists(obj_dialogue)) |
| 53 |
{ |
| 54 |
if (!global.cutscene) |
| 55 |
scr_cutscene_end(); |
| 56 |
} |
| 57 |
if (instance_exists(obj_steamworks_13_controller) && obj_steamworks_13_controller.robot_part_no_loop == true) |
| 58 |
obj_steamworks_13_controller.robot_part_no_loop = false; |
| 59 |
} |
| 60 |
} |
| 61 |
exit; |
| 62 |
} |
| 63 |
if (robot_item_is_carried == true) |
| 64 |
{ |
| 65 |
x = robot_item_x_player; |
| 66 |
y = robot_item_y_player; |
| 67 |
depth = obj_pl.depth - 1; |
| 68 |
var pl_image_index = floor(obj_pl.image_index); |
| 69 |
if (obj_pl.direction == 0 || obj_pl.direction == 180) |
| 70 |
{ |
| 71 |
if (pl_image_index == 1) |
| 72 |
y += 1; |
| 73 |
} |
| 74 |
else if (pl_image_index == 1 || pl_image_index == 3) |
| 75 |
{ |
| 76 |
y -= 1; |
| 77 |
} |
| 78 |
if (keyboard_multicheck(1) && obj_pl.state == scr_normal_state) |
| 79 |
{ |
| 80 |
robot_item_is_jumping = true; |
| 81 |
audio_play_sound(snd_playerjump, 1, 0); |
| 82 |
robot_item_y_target = obj_pl.y + 16; |
| 83 |
if (place_free(obj_pl.x + 20, obj_pl.y + 10)) |
| 84 |
{ |
| 85 |
robot_item_x_target = obj_pl.x + 20; |
| 86 |
} |
| 87 |
else if (place_free(obj_pl.x - 20, obj_pl.y + 10)) |
| 88 |
{ |
| 89 |
robot_item_x_target = obj_pl.x - 20; |
| 90 |
} |
| 91 |
else if (place_free(obj_pl.x, obj_pl.y + 20)) |
| 92 |
{ |
| 93 |
robot_item_x_target = obj_pl.x; |
| 94 |
robot_item_y_target = obj_pl.y + 20; |
| 95 |
} |
| 96 |
else |
| 97 |
{ |
| 98 |
robot_item_x_target = obj_pl.x; |
| 99 |
robot_item_y_target = obj_pl.y - 20; |
| 100 |
} |
| 101 |
obj_pl.state = scr_frozen_state; |
| 102 |
obj_pl.image_index = 0; |
| 103 |
obj_pl.image_speed = 0; |
| 104 |
} |
| 105 |
} |