korlibs / korlibs/korge

Suggestion: Make atlas.getSpriteAnimation sort frames by filename.

Open
#569 1 comment 0 reactions 0 assignees View on GitHub
bug enhancement
Dominant language
Kotlin
Stars
3k
Forks
148
Avg merge
13h 44m
Merged PRs (30d)
1

Description

For example:

``` kotlin
fun Atlas.getSpriteAnimation(prefix: String = "", defaultTimePerFrame: TimeSpan = TimeSpan.NIL): SpriteAnimation =
SpriteAnimation(this.entries.filter { it.filename.startsWith(prefix) }***.sortedBy { it.filename }***.map { it.slice }.toFastList(), defaultTimePerFrame)

fun Atlas.getSpriteAnimation(regex: Regex, defaultTimePerFrame: TimeSpan = TimeSpan.NIL): SpriteAnimation =
SpriteAnimation(this.entries.filter { regex.matches(it.filename) }***.sortedBy { it.filename }***.map { it.slice }.toFastList(), defaultTimePerFrame)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Locate the Atlas.getSpriteAnimation overloads shown in the issue and inspect how matching entries are currently collected. Ensure the resulting frames are ordered by filename for both the prefix and Regex variants, then run the relevant project tests or checks to confirm the animation order.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
game-dev
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.