I wanted to know if there was a way to disable the Remove when item clicked event code after a couple of seconds have past is that possible?
I donāt have the option to put it in no items Iām trying to disable the remove when item clicked after a couple of seconds so that I can click on the item again
Hi @JohnSpace,
Judging from the posts above, weāre not entirely clear on what youāre trying to achieve.
Could you share the code youāre using by selecting the part thatās causing you problems and right-clicking and selecting Save as Image, or allow your project to be remixed and share the link, so that we can see the context for your description, and suggest appropriate solutions?
Thanks,
Geoff @ TechLeap
Sorry about that Iām not sure how to explain it go to scene 3 Iām trying to make a turn based rpg game CoSpaces Edu :: Tom's Mysterious Rpg Adventure (Test) I wanna make it so that when I click on fight it will activate the remove when item clicked event code then after a couple of seconds it will deactivate the remove when item clicked event code
Iāll go try that out (Also if you donāt understand what I mean here is a link) CoSpaces Edu :: Tomās Mysterious Rpg Adventure (Test)
Do you just want to deactivate the button while the action is taking place? In other platforms I have achieved button activate and deactivate using a Boolean (True/False) variable. Set ābuttonClickableā to true on start.
If (buttonClickable == true)
{When clicked
{
buttonClickable= false;
//do function;
}
}
Then set the buttonClickable back to true whenever you want it clickable again either after a set time or when the other actions are completed.
Is that what you were thinking?
You could create a function that initialises the onClick event. And schedule this function call when the event was disposed.
function setOnClick() {
obj.input.onClick(()=>{
//your onclick logic
obj.input.onClick(null)
Time.schedule(setOnClick, 2)
})
}
setOnClick();
I think yes that is correct let me try it
Wait how do I set a timer with scripting I havenāt really learned that yet
let time = 10;
let timeDisplay = Scene.getItem("Item ID Here") as Text;
timeDisplay.Text = "Time: " + time;
Time.scheduleRepeating(()=>{
if (time = 0){
timeDisplay.Text = "Time is up!"
dispose();}
else{
time -= 1;
timeDisplay.Text = "Time: " + time;},
1);
Function schedule executes a function after a delay
in seconds.
Time.schedule(()=>{
/*your code here*/
}, delay);