L
Lori
Guest
Hello everbody,
total newbie here, so please go easy on me ;-)
I'm trying to make a round of a quiz game in which every click on the button "Next clue" (an instance of obj_btn) gives you another clue (instance of obj_clue).
I've tried setting it up so that a click on the button will add 1 to a variable called clickCounter.
Then I wanted to use the value of clickCounter in a switch/ if statements to create each new instance.
So if the button had been clicked once, you'd have one extra clue; twice, you'd have two extra clues, etc.
When I run it, one click works and I get one extra clue, but after that, the button becomes useless.
Now, on the topic of mouse_check_button_released(mb_left), the documentation says: "This function will return true if the mouse button being checked has been released or false if it has not. This function will only be triggered once for any mouse button when it is released and to trigger it again the button will need to have been pressed and released again."
So I gather my mouse_check only returns "true" ones and then cannot perform another click.
Is there a way to work around this? Can I manually set the mouse_check to "false" or something?!
Sorry, seems like an easy problem with a hopefully onvious answer but I have not been able to google anything helpful...
Thanks & cheers
Lori
---
Here's one of the ways I tried - though I'm also not quite sure of where to put the code. The room or the obj_btn?
using Game Maker Studio v1.4.1757
total newbie here, so please go easy on me ;-)
I'm trying to make a round of a quiz game in which every click on the button "Next clue" (an instance of obj_btn) gives you another clue (instance of obj_clue).
I've tried setting it up so that a click on the button will add 1 to a variable called clickCounter.
Then I wanted to use the value of clickCounter in a switch/ if statements to create each new instance.
So if the button had been clicked once, you'd have one extra clue; twice, you'd have two extra clues, etc.
When I run it, one click works and I get one extra clue, but after that, the button becomes useless.
Now, on the topic of mouse_check_button_released(mb_left), the documentation says: "This function will return true if the mouse button being checked has been released or false if it has not. This function will only be triggered once for any mouse button when it is released and to trigger it again the button will need to have been pressed and released again."
So I gather my mouse_check only returns "true" ones and then cannot perform another click.
Is there a way to work around this? Can I manually set the mouse_check to "false" or something?!
Sorry, seems like an easy problem with a hopefully onvious answer but I have not been able to google anything helpful...
Thanks & cheers
Lori
---
Here's one of the ways I tried - though I'm also not quite sure of where to put the code. The room or the obj_btn?
Code:
var nextClickCounter = 0;
if mouse_check_released(mb_left)
{
nextClickCounter += 1;
}
if nextClickCounter = 0
{
var clue = instance_create(80,240,obj_clue); //creates first instance of the "Next clue" button
clue.v_clue = "Clue 1"; //prints "Clue 1" on the button
}
if nextClickCounter = 1
{
var clue = instance_create(80+147,240,obj_clue);
clue.v_clue = "Clue 2";
}
if nextClickCounter = 2
{
var clue = instance_create(80+147*2,240,obj_clue);
clue.v_clue = "Clue 3";
}
if nextClickCounter >= 3
{
var clue = instance_create(80+147*3,240,obj_clue);
clue.v_clue = "Clue 4";
}
Last edited by a moderator: