RhenaudTheLukark / CreateYourFrisk

Rhenaud The Lukark's Unitale fork
GNU General Public License v3.0
133 stars 56 forks source link

[Issue] Incorrect indexing when setting .currentframe #30

Closed TomaszewskiPatryk closed 5 years ago

TomaszewskiPatryk commented 5 years ago

Describe the bug When reading .currentframe (DEBUG(sprite.currentframe)), it returns the current frame as if they were 1-indexed. However, when setting .currentframe (sprite.currentframe = 1) they are set as if they were shifted by 1 (similar to 0-indexing, but the first element is now the last one). According to the documentation, frames are supposed to be 1-indexed, meaning that setting .currentframe uses wrong indexing.

Code To Reproduce

sprite = CreateSprite("bullet","Top")
sprite.SetAnimation({"bullet","poseur"})
sprite.currentframe = 1
DEBUG(sprite.currentframe)

or

sprite = CreateSprite("bullet","Top")
sprite.SetAnimation({"bullet","poseur"})
sprite.animationpaused = true
function Update()
  sprite.currentframe = sprite.currentframe
end

Setup:

RhenaudTheLukark commented 5 years ago

Fixed in CYF v0.6.2.1!