Open hyeonhh opened 1 year ago
Hi. Its because both of your if conditionals are true. isClicked == 2 true and then else branch in second if conditional also executes (isClicked++). Try this code. See if it works for you
if(isClicked != 2) {
isClicked++
if(isClicked > 4) {
isClicked = 1
squeezedLemon = (2..4).random()
}
} else {
squeezedLemon--
if (squeezedLemon == 0) {
isClicked = 3
}
}
` @Composable fun makingLemonade( contentText: String, modifier: Modifier=Modifier.padding(16.dp)) {
This is how I implemented the code. First of all, we looked at each process of making lemonade as the number 1,2,3,4 in the isClick variable. RandomLemon variable randomly generates the number of times a lemon needs to be pressed This was saved in the squaredzedLemon variable.
The tabCountNow variable has been remembered to save the number of times the current compression has been made.
And on Modifier.Clickable I implemented the following logic
But just one tap of the execution results and it goes to the next image. What's the problem?
`