Skip to content

Commit

Permalink
Scatter speed of logos
Browse files Browse the repository at this point in the history
  • Loading branch information
zsmb13 committed Sep 25, 2023
1 parent 812896f commit 9945346
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/nativeMain/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ class BouncingLogo(
private var xPos: Double
private var yPos: Double

private val speed = SPEED * Random.nextDouble(0.9, 1.1)

init {
val margin = sqrt(LOGO_AREA.toDouble())
xPos = Random.nextDouble(margin, screenWidth - margin)
Expand All @@ -118,8 +120,8 @@ class BouncingLogo(
}

fun animateOneFrame() {
xPos += xDelta * SPEED
yPos += yDelta * SPEED
xPos += xDelta * speed
yPos += yDelta * speed

when {
xDelta > 0 && right >= screenWidth -> {
Expand Down

0 comments on commit 9945346

Please sign in to comment.