Skip to content

Commit

Permalink
fixed movement issue locked to idle by setting player animation to pl…
Browse files Browse the repository at this point in the history
…ayer state
  • Loading branch information
ColstonBod-oy committed Mar 24, 2024
1 parent 39eede0 commit de61112
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/commonMain/kotlin/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class MyScene : Scene() {

characters = resourcesVfs["chumbo.ase"].readImageDataContainer(ASE.toProps(), atlas = atlas)
player = imageDataView(characters["chumbo"], "idle", playing = true, smoothing = false) {
anchor(0.5f, 0f)
xy(currentPlayerPos)
}

Expand Down Expand Up @@ -150,11 +151,9 @@ class MyScene : Scene() {
animator {
tween(time = time, easing = Easing.EASE_IN)
block {
player.animation = name
player.animation = playerState
}
}

player.play()
}
}

Expand All @@ -171,7 +170,6 @@ class MyScene : Scene() {

fun updated(right: Boolean, up: Boolean, scale: Float = 1f) {
if (!up) {
player.anchor(0.5f, 0f)
player.scaleX = player.scaleX.absoluteValue * if (right) +1f else -1f
tryMoveDelta(Point(2.0, 0) * (if (right) +1 else -1) * scale)
player.speed = 2.0 * scale
Expand All @@ -187,8 +185,7 @@ class MyScene : Scene() {
virtualController.apply {
down(GameButton.BUTTON_SOUTH) {
val isInGround = playerSpeed.y.isAlmostZero()
//if (isInGround) {
if (true) {
if (isInGround) {
if (!jumping) {
jumping = true
updateState()
Expand Down

0 comments on commit de61112

Please sign in to comment.