1 |
scr_get_inputscr_get_inputfunction scr_get_input()
{
if (live_call())
return global.live_result;
scr_stick_press();
global.down_key = keyboard_check(vk_down) || gamepad_button_check(0, gp_padd) || gamepad_axis_value(0, gp_axislv);
global.left_key = keyboard_check(vk_left) || gamepad_button_check(0, gp_padl) || -gamepad_axis_value(0, gp_axislh);
global.right_key = keyboard_check(vk_right) || gamepad_button_check(0, gp_padr) || gamepad_axis_value(0, gp_axislh);
global.up_key = keyboard_check(vk_up) || gamepad_button_check(0, gp_padu) || -gamepad_axis_value(0, gp_axislv);
global.down_keyp = keyboard_check_pressed(vk_down) || gamepad_button_check_pressed(0, gp_padd) || down_stick;
global.left_keyp = keyboard_check_pressed(vk_left) || gamepad_button_check_pressed(0, gp_padl) || left_stick;
global.right_keyp = keyboard_check_pressed(vk_right) || gamepad_button_check_pressed(0, gp_padr) || right_stick;
global.up_keyp = keyboard_check_pressed(vk_up) || gamepad_button_check_pressed(0, gp_padu) || up_stick;
if (gamepad_button_check_pressed(0, gp_padd) + gamepad_button_check_pressed(0, gp_padu) + gamepad_button_check_pressed(0, gp_padl) + gamepad_button_check_pressed(0, gp_padr) + down_stick + left_stick + right_stick + up_stick + gamepad_button_check_pressed(0, global.button1) + gamepad_button_check_pressed(0, global.button2) + gamepad_button_check_pressed(0, global.button3) + instance_exists(obj_phone_controls))
global.using_gamepad = true;
else if (keyboard_check(vk_anykey))
global.using_gamepad = false;
if (global.using_gamepad)
{
if (global.button1 == gp_face1)
global.action_key = "A";
else if (global.button1 == gp_face2)
global.action_key = "B";
else if (global.button1 == gp_face3)
global.action_key = "X";
else if (global.button1 == gp_face4)
global.action_key = "Y";
if (global.button2 == gp_face1)
global.cancel_key = "A";
else if (global.button2 == gp_face2)
global.cancel_key = "B";
else if (global.button2 == gp_face3)
global.cancel_key = "X";
else if (global.button2 == gp_face4)
global.cancel_key = "Y";
if (global.button3 == 32769)
global.pause_key = "A";
else if (global.button3 == 32770)
global.pause_key = "B";
else if (global.button3 == 32771)
global.pause_key = "X";
else if (global.button3 == 32772)
global.pause_key = "Y";
}
else
{
global.pause_key = "C";
global.action_key = "Z";
global.cancel_key = "X";
}
if (instance_exists(obj_phone_controls))
{
global.down_key += obj_phone_controls.phn_down;
global.left_key += obj_phone_controls.phn_left;
global.right_key += obj_phone_controls.phn_right;
global.up_key += obj_phone_controls.phn_up;
global.down_keyp = sign(global.down_keyp + obj_phone_controls.phn_downp);
global.left_keyp = sign(global.left_keyp + obj_phone_controls.phn_leftp);
global.right_keyp = sign(global.right_keyp + obj_phone_controls.phn_rightp);
global.up_keyp = sign(global.up_keyp + obj_phone_controls.phn_upp);
}
} (); |
2 |
var confirm_key = keyboard_multicheck_pressed(0); |
3 |
var cancel_key = keyboard_multicheck_pressed(2); |
4 |
var rotate_key = keyboard_multicheck_pressed(1); |
5 |
var rotate_key_released = keyboard_multicheck_released(1); |
6 |
if (robot_item_is_destroyed) |
7 |
{ |
8 |
image_alpha -= 0.1; |
9 |
if (image_alpha <= 0) |
10 |
instance_destroy(); |
11 |
vspeed -= 0.1; |
12 |
exit; |
13 |
} |
14 |
if (confirm_key && !robot_item_placed) |
15 |
{ |
16 |
audio_play_sound(snd_switch, 1, 0); |
17 |
robot_item_placed = true; |
18 |
exit; |
19 |
} |
20 |
if (rotate_key && !robot_item_placed) |
21 |
{ |
22 |
robot_item_is_rotating = true; |
23 |
robot_item_rotate_dir *= -1; |
24 |
obj_robot_build_cursor.soul_can_move = false; |
25 |
} |
26 |
if (rotate_key_released) |
27 |
{ |
28 |
robot_item_is_rotating = false; |
29 |
obj_robot_build_cursor.soul_can_move = true; |
30 |
} |
31 |
if (robot_item_is_rotating == true) |
32 |
{ |
33 |
image_angle += ((global.right_key * 3) - (global.left_key * 3)); |
34 |
image_xscale += ((global.up_key * 0.05) - (global.down_key * 0.05)); |
35 |
image_xscale = clamp(image_xscale, 0.5, 2); |
36 |
image_yscale = image_xscale; |
37 |
} |
38 |
if (cancel_key && !robot_item_placed) |
39 |
{ |
40 |
robot_item_placed = false; |
41 |
robot_item_is_destroyed = true; |
42 |
audio_play_sound(snd_monster_damage_miss, 1, 0); |
43 |
exit; |
44 |
} |
45 |
with (obj_robot_build_item) |
46 |
{ |
47 |
if (!robot_item_placed) |
48 |
exit; |
49 |
} |
50 |
if (place_meeting(x, y, obj_robot_build_cursor) && confirm_key) |
51 |
{ |
52 |
audio_play_sound(snd_confirm, 1, 0); |
53 |
robot_item_placed = false; |
54 |
} |
55 |
image_alpha = obj_robot_build_controller.draw_alpha; |