NextFrame advances the current animation by one frame.
()
| 82 | |
| 83 | // NextFrame advances the current animation by one frame. |
| 84 | func (ac *AnimationComponent) NextFrame() { |
| 85 | if len(ac.CurrentAnimation.Frames) == 0 { |
| 86 | log.Println("No frame data for this animation") |
| 87 | return |
| 88 | } |
| 89 | |
| 90 | ac.index++ |
| 91 | ac.change = 0 |
| 92 | if ac.index >= len(ac.CurrentAnimation.Frames) { |
| 93 | ac.index = 0 |
| 94 | |
| 95 | if !ac.CurrentAnimation.Loop { |
| 96 | ac.CurrentAnimation = nil |
| 97 | return |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | // AnimationSystem tracks AnimationComponents, advancing their current animation. |
| 103 | type AnimationSystem struct { |
no outgoing calls