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

Author Topic: Animation......again  (Read 1857 times)

0 Members and 1 Guest are viewing this topic.

asdatapel

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Animation......again
« on: September 04, 2011, 01:30:59 am »
Hello everyone. Ive made an animation class that inherits from sprite, and uses a subrect to change the frames. Im trying to make a class that holds multiple animation objects. However, the problem with this is that I can't use the functions of sprite with this object. For example say this class was called mario.
I could do Draw(*Mario.getPointerOfCurrentSprite)
but I cant do mario.move()
or mario.SetX() because each Animation(Sprite) has its own location. Any Help?

Haikarainen

  • Guest
Animation......again
« Reply #1 on: September 04, 2011, 08:44:39 am »
Create a class for holding animations! Simple as that!

Code: [Select]
class AnimationHolder{
Animation* GetAnimation(name/id/whatever)

std::vector<Animation*> Animations;
}


Then just;
Code: [Select]

AnimationHolder animations;
Window.Draw(animations.GetAnimation("walking_left"));

asdatapel

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Animation......again
« Reply #2 on: September 04, 2011, 05:30:10 pm »
but if i have multiple animations in that holder, can i do animations.SetX();?

 

anything