[ad_1]
I have a function SendInstruction which send instructions to the user to press a button with label x for 3 seconds. I have four buttons with labels y,z and w.
fun SendInstruction(buttonLabel:String):String{
return buttonLabel
}
I have a counter that either increments by 20 if correct sent instruction matches user clicked button and decrements if not correct.
But when correct for 3 seconds then another instruction can be sent for button y otherwise user must pass button x to go to y and also must pass y to go to z and must pass z to go to w
Here is what i tried so far
var counter:Int = 0
GlobalScope.launch{
SendInstruction("click button x")
if(userclicked)//always true for 3 seconds
delay(3000)//check in 3s if instructions matches user clicked
counter +=20
SendInstruction("click button y")
if(userclicked)//always true for 3 s
delay(3000)//check in 3s if instruction matches user clicked
else
counter = 0
//restart
}
But it just doesn’t work, can anyone help me with this please.
[ad_2]