RhenaudTheLukark/CreateYourFrisk

[Issue] Incorrect indexing when setting .currentframe

Closed this issue · 1 comments

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:

  • OS: Windows
  • Version 0.6.2

Fixed in CYF v0.6.2.1!