diff --git a/examples/web-compose-bird/build.gradle.kts b/examples/web-compose-bird/build.gradle.kts index 6af4206885..821321b27c 100644 --- a/examples/web-compose-bird/build.gradle.kts +++ b/examples/web-compose-bird/build.gradle.kts @@ -1,7 +1,7 @@ // Add compose gradle plugin plugins { - kotlin("multiplatform") version "1.5.10" - id("org.jetbrains.compose") version "0.5.0-build235" + kotlin("multiplatform") version "1.5.21" + id("org.jetbrains.compose") version "0.5.0-build262" } group = "com.theapache64.composebird" version = "1.0.0-alpha01" diff --git a/examples/web-compose-bird/demo.gif b/examples/web-compose-bird/demo.gif index 588adf7f5e..b826c3137b 100644 Binary files a/examples/web-compose-bird/demo.gif and b/examples/web-compose-bird/demo.gif differ diff --git a/examples/web-compose-bird/src/jsMain/kotlin/core/ComposeBirdGame.kt b/examples/web-compose-bird/src/jsMain/kotlin/core/ComposeBirdGame.kt index d702efd5bd..e445cb3909 100644 --- a/examples/web-compose-bird/src/jsMain/kotlin/core/ComposeBirdGame.kt +++ b/examples/web-compose-bird/src/jsMain/kotlin/core/ComposeBirdGame.kt @@ -7,6 +7,9 @@ import data.GameFrame import data.Tube import kotlin.js.Date +/** + * Game logic + */ class ComposeBirdGame : Game { companion object { @@ -39,6 +42,9 @@ class ComposeBirdGame : Game { ) } + /** + * To build a random level + */ private fun buildLevel(): List { return mutableListOf().apply { var tubesAdded = 0 @@ -59,6 +65,9 @@ class ComposeBirdGame : Game { } + /** + * To build a random vertical tube/pipe + */ private fun buildRandomTube(): List { // creating a full tube val tube = mutableListOf().apply { @@ -130,6 +139,9 @@ class ComposeBirdGame : Game { } } + /** + * To check if the bird collided with the tube (collision-detection) + */ private fun isCollidedWithTube(newBirdPos: Int, tubes: List): Boolean { val birdTube = tubes.find { it.position == BIRD_COLUMN } return birdTube?.coordinates?.get(newBirdPos) ?: false diff --git a/examples/web-compose-bird/src/jsMain/kotlin/core/Game.kt b/examples/web-compose-bird/src/jsMain/kotlin/core/Game.kt index d128fd68ea..35e593e903 100644 --- a/examples/web-compose-bird/src/jsMain/kotlin/core/Game.kt +++ b/examples/web-compose-bird/src/jsMain/kotlin/core/Game.kt @@ -3,6 +3,9 @@ package core import androidx.compose.runtime.State import data.GameFrame +/** + * A generic game interface + */ interface Game { val gameFrame: State fun step()