-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update 2048 tutorial to KorGE 3.0 #57
Comments
Hello, Korge team |
It would be nice to have it in the repo too - so it could be updated with the rest of the code |
I've just completed the tutorial. There are two breaking changes I've encountered so far that I would say aren't minor.
fun Container.showGameOver(onRestart: () -> Unit) = container {
position(leftIndent, topIndent)
fun restart() {
this@container.removeFromParent()
onRestart()
}
roundRect(fieldSize, fieldSize, 5.0, fill = Colors["#FFFFFF33"])
text("Game Over", 60.0, Colors.BLACK, font) {
centerBetween(0.0, 0.0, fieldSize, fieldSize)
y -= 60
}
uiText("Try again", 120.0, 35.0) {
centerBetween(0.0, 0.0, fieldSize, fieldSize)
y += 20
uiSkin = UISkin {
textColor = RGBA(0, 0, 0)
textSize = 40.0
font = font
}
onOver {
textColor = RGBA(90, 90, 90)
}
onOut {
textColor = RGBA(0, 0, 0)
}
onDown {
textColor = RGBA(120, 120, 120)
}
onClick { restart() }
}
keys.down {
when (it.key) {
Key.ENTER, Key.SPACE -> restart()
else -> Unit
}
}
} |
No description provided.
The text was updated successfully, but these errors were encountered: