Skip to content

Commit

Permalink
Return the previous spritesheet index when update the spritesheet.
Browse files Browse the repository at this point in the history
  • Loading branch information
dwursteisen committed Feb 12, 2024
1 parent 29a49f6 commit d93d06d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class SprLib(val gameOptions: GameOptions, val resourceAccess: GameResourceAcces
@TinyFunction(
"Switch to another spritesheet. " +
"The index of the spritesheet is given by it's position in the spritesheets field from the `_tiny.json` file." +
"The first spritesheet is at the index 0.",
"The first spritesheet is at the index 0. It retuns the previous spritesheet.",
)
internal inner class sheet : OneArgFunction() {

Expand All @@ -96,12 +96,13 @@ class SprLib(val gameOptions: GameOptions, val resourceAccess: GameResourceAcces

@TinyCall("Switch to the N spritesheet")
override fun call(@TinyArg("spritesheetN") arg: LuaValue): LuaValue {
val previousSpriteSheet = currentSpritesheet
currentSpritesheet = if (arg.isnil()) {
0
} else {
arg.checkint()
}
return NONE
return valueOf(previousSpriteSheet)
}
}

Expand Down

0 comments on commit d93d06d

Please sign in to comment.