Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Updating a sprite sheet animation  (Read 1505 times)

0 Members and 2 Guests are viewing this topic.

runizgozilla

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Updating a sprite sheet animation
« on: June 22, 2014, 11:20:36 pm »
I'm updating my animation with this line:
Code: [Select]
animation.setTextureRect(IntRect((frame-1)*16, 0, 16, 16));Where frame is a number between 0 and 9 and 16 is the width and height of an individual frame of my sprite sheet.

This gives me the first frame and not anything else.

Why doesn't this work?
« Last Edit: June 22, 2014, 11:24:38 pm by runizgozilla »

runizgozilla

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Re: Updating a sprite sheet animation
« Reply #1 on: June 22, 2014, 11:26:02 pm »
Through experimentation I can now definitely say that if you initialize a texture at the first frame nothing else will be loaded.  Sorry for wasting everyone's time the second time in just under 24 hours.

Mutoh

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Updating a sprite sheet animation
« Reply #2 on: June 24, 2014, 10:27:02 pm »
Ever considered Thor? :D Its animation modules already take care of all this for you, and it's built on top of SFML.

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Updating a sprite sheet animation
« Reply #3 on: June 29, 2014, 03:37:47 pm »
If the range of frame is 0-9, I don't think you should be subtracting 1 from it.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything