Master Cabalist
Member
Hi
I'm trying to create a yes/no dialog box. If you selected yes a certain number of gems are subtracted from the player's gems and a character (bat) is unlocked. If you click on No then the dialogue should vanish..
There is something I'm missing and I was hoping somebody could give me a hand. The "No" part of the dialogue box isn't working. Wherever I click on the dialogue box it just unlocks the bat and the dialogue vanishes. Whether I click on
No or Yes it unlocks the bat and the dialogue vanishes.
Step:
Draw GUI:
I'm trying to create a yes/no dialog box. If you selected yes a certain number of gems are subtracted from the player's gems and a character (bat) is unlocked. If you click on No then the dialogue should vanish..
There is something I'm missing and I was hoping somebody could give me a hand. The "No" part of the dialogue box isn't working. Wherever I click on the dialogue box it just unlocks the bat and the dialogue vanishes. Whether I click on
No or Yes it unlocks the bat and the dialogue vanishes.
Step:
GML:
if (mouse_x > 112 && mouse_y > 150 && mouse_x < 185 && mouse_y < 170 && query_batC == true)
{
show_debug_message("query bat no selected")
query_batC = false;
if (instance_exists(GemPackObject1)) { instance_destroy(GemPackObject1) }
if (instance_exists(PurchaseMenuObject)) { instance_destroy(PurchaseMenuObject) }
}
if mouse_check_button(mb_left)
{
//turn on menu
if position_meeting(mouse_x, mouse_y, BatsFaceHiddenC)
{
//below doesn't execute
show_debug_message("position meeting")
//below doesn't execute
show_debug_message("mouse check button")
//Player.hasbatB = true;
hasbatC = false
query_batC = true;
}
//Unlock prompt? Below
//clicked yes
if mouse_check_button(mb_left)
{
//below yes clicked
show_debug_message("Yes clicked on purchase object")
if (mouse_x > 119 && mouse_y > 200 && mouse_x < 187 & mouse_y < 210 && query_batC == true)
{
//Yes selected
show_debug_message("query bat yes selected"); //successful
new_gems = global.gems - 1000
if (new_gems > 0)
{
global.gems -= 1000
global.select_bat = 3; //the bat to drop
Player.hasbatC = true;
query_batC = false;
instance_destroy(GemPackObject1);
if (!instance_exists(BatsFaceC))
{
instance_create_depth(x, y, -1900, BatsFaceC)
}
instance_destroy(PurchaseMenuObject)
}
else
{
show_debug_message("Not enough gems")
query_batC = false
instance_destroy(GemPackObject1);
if (last_menu_timer <= 0)
{
draw_text_color(350, 650, "Not enough gems", c_black, c_black, c_black, c_black, 1)
last_menu_timer = room_speed
}
}
visible = false;
//instance_destroy()
}
if (mouse_x > 112 && mouse_y > 150 && mouse_x < 185 && mouse_y < 170 && query_batC == true)
{
show_debug_message("query bat no selected")
query_batC = false;
if (instance_exists(GemPackObject1)) { instance_destroy(GemPackObject1) }
if (instance_exists(PurchaseMenuObject)) { instance_destroy(PurchaseMenuObject) }
}
}
}
Code:
/// @description Insert description here
// You can write your code in this editor
//print menu
//print menu
draw_set_font(Arial_Font_Modified)
if (query_batC == true && Player.hasbatC != true)
{
/***********NEW CODE************/
if (!instance_exists(GemPackObject1))
{
instance_create_depth(550,650,-1200,GemPackObject1);
}
if (!instance_exists(PurchaseMenuObject))
{
instance_create_depth(100, 200,-1200, PurchaseMenuObject);
}
draw_text_ext_transformed_color(100, 200, "3,000 Gems", 5, 300, 0.75, 0.75, 0, c_white, c_white, c_white, c_white, 1)
}
//}
/*
if (query_batB == false)
{
show_debug_message("No query menu")
if (instance_exists(GemPackObject1))
{
show_debug_message("Destroy gem pack")
instance_destroy(GemPackObject1)
}
}
*/
Last edited: