Skip to content

Commit

Permalink
added score text
Browse files Browse the repository at this point in the history
Signed-off-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com>
  • Loading branch information
j10a1n15 committed Sep 18, 2024
1 parent 96c530e commit a175795
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/kotlin/gay/j10a1n15/sillygames/games/Snake.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import gay.j10a1n15.sillygames.utils.Vector2d
import gg.essential.elementa.UIComponent
import gg.essential.elementa.components.UIBlock
import gg.essential.elementa.components.UIContainer
import gg.essential.elementa.components.UIText
import gg.essential.elementa.constraints.CenterConstraint
import gg.essential.elementa.dsl.childOf
import gg.essential.elementa.dsl.constrain
Expand Down Expand Up @@ -125,6 +126,11 @@ class Snake : Game() {
} childOf background
}

UIText("Score: ${score.get()}").constrain {
x = CenterConstraint()
y = background.constraints.y
} childOf container

return container
}

Expand Down

0 comments on commit a175795

Please sign in to comment.