You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say I only want to implement the cloud animation, so I only have the cloud state. If I change the position of the cloud using moveForward, will it update the cloud state? I tried this, but it's not recomposing.
Please let me know if there are any issues with my code.
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val deviceMetrics = DisplayMetrics()
windowManager.defaultDisplay.getMetrics(deviceMetrics)
deviceWidthInPixels = deviceMetrics.widthPixels
distanceBetweenCactus = (deviceWidthInPixels * 0.4f).toInt()
setContent {
DinoRunTheme(darkTheme = isSystemInDarkTheme()) {
val cloudsState by remember {
mutableStateOf(
CloudState(
maxClouds = MAX_CLOUDS,
speed = CLOUDS_SPEED
)
)
}
val cloudsColor = getCloudColor()
GameScreen(cloudsState)
}
}
}
}
Let's say I only want to implement the cloud animation, so I only have the cloud state. If I change the position of the cloud using moveForward, will it update the cloud state? I tried this, but it's not recomposing.
Please let me know if there are any issues with my code.
The text was updated successfully, but these errors were encountered: