1 |
scr_get_inputscr_get_inputfunction scr_get_input() //gml_Script_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(1) |
4 |
x += ((global.right_key - global.left_key) * 4) |
5 |
y += ((global.down_key - global.up_key) * 4) |
6 |
x = clamp(x, 60, 260) |
7 |
y = clamp(y, 20, 210) |
8 |
var cards_moving = false |
9 |
with (obj_card_game_card) |
10 |
{ |
11 |
if (card_is_active == true || card_success == true || alarm[0] > -1)alarm[0]if (cardg_selected_card[1] != -1)
{
if (cardg_selected_card[0].card_type == cardg_selected_card[1].card_type)
{
cardg_selected_card[0].card_success = true
cardg_selected_card[1].card_success = true
audio_play_sound(snd_card_game_match, 1, 0)
}
}
cardg_selected_card[0].card_is_selected = false
if (cardg_selected_card[1] != -1)
cardg_selected_card[1].card_is_selected = false
cardg_selected_card[0] = -1
if (cardg_selected_card[1] != -1)
cardg_selected_card[1] = -1
with (obj_card_game_card)
image_alpha = 1 |
12 |
cards_moving = true |
13 |
} |
14 |
if (cardg_selected_card[0] != -1 && cardg_selected_card[1] != -1) |
15 |
{ |
16 |
if (!alarm[0]) |
17 |
alarm[0] = 15alarm[0]if (cardg_selected_card[1] != -1)
{
if (cardg_selected_card[0].card_type == cardg_selected_card[1].card_type)
{
cardg_selected_card[0].card_success = true
cardg_selected_card[1].card_success = true
audio_play_sound(snd_card_game_match, 1, 0)
}
}
cardg_selected_card[0].card_is_selected = false
if (cardg_selected_card[1] != -1)
cardg_selected_card[1].card_is_selected = false
cardg_selected_card[0] = -1
if (cardg_selected_card[1] != -1)
cardg_selected_card[1] = -1
with (obj_card_game_card)
image_alpha = 1 |
18 |
image_alpha = 0.5 |
19 |
return; |
20 |
} |
21 |
if cards_moving |
22 |
image_alpha = 0.5 |
23 |
else |
24 |
image_alpha = 1 |
25 |
if (confirm_key && (!cards_moving)) |
26 |
{ |
27 |
var nearest_card = instance_nearest(x, y, obj_card_game_card) |
28 |
if (nearest_card.card_is_active == false) |
29 |
{ |
30 |
if (cardg_selected_card[0] == -1) |
31 |
{ |
32 |
cardg_selected_card[0] = nearest_card |
33 |
nearest_card.card_is_selected = true |
34 |
with (obj_card_game_card) |
35 |
{ |
36 |
if (!(point_in_rectangle(x, y, (other.cardg_selected_card[0].x - 55), (other.cardg_selected_card[0].y - 70), (other.cardg_selected_card[0].x + 55), (other.cardg_selected_card[0].y + 70)))) |
37 |
image_alpha = 0.4 |
38 |
} |
39 |
audio_play_sound(snd_card_game_select, 1, 0) |
40 |
} |
41 |
else if (nearest_card == cardg_selected_card[0]) |
42 |
cancel_key = true |
43 |
else if (nearest_card != cardg_selected_card[0] && point_in_rectangle(nearest_card.x, nearest_card.y, (cardg_selected_card[0].x - 55), (cardg_selected_card[0].y - 70), (cardg_selected_card[0].x + 55), (cardg_selected_card[0].y + 70))) |
44 |
{ |
45 |
cardg_selected_card[1] = nearest_card |
46 |
nearest_card.card_is_selected = true |
47 |
audio_play_sound(snd_card_game_select, 1, 0) |
48 |
} |
49 |
} |
50 |
} |
51 |
if (cancel_key || cards_moving) |
52 |
{ |
53 |
if (cardg_selected_card[0] != -1) |
54 |
alarm[0] = 1alarm[0]if (cardg_selected_card[1] != -1)
{
if (cardg_selected_card[0].card_type == cardg_selected_card[1].card_type)
{
cardg_selected_card[0].card_success = true
cardg_selected_card[1].card_success = true
audio_play_sound(snd_card_game_match, 1, 0)
}
}
cardg_selected_card[0].card_is_selected = false
if (cardg_selected_card[1] != -1)
cardg_selected_card[1].card_is_selected = false
cardg_selected_card[0] = -1
if (cardg_selected_card[1] != -1)
cardg_selected_card[1] = -1
with (obj_card_game_card)
image_alpha = 1 |
55 |
} |