Animation frame speed by instance variable?

0 favourites
  • 10 posts
From the Asset Store
three fully animated characters ideal for your RPG side scroller projects
  • Well, it's actually probably more complicated of an idea than the title suggests.

    So here's the SCOOP. (you like that? See I had ice cream today it was good) I have a several animations of a character where each one is exactly the same, only with minor things added. For example, a run animation with a helmet on, a run animation with no helmet on, a run animation with hair, a run animation with a weapon equipped, etc. Each are a separate object that go into the Character family. But they all must have the same frame speeds, because besides the equipment, they look exactly the same.

    I have simply far too many animations for each variation for me to want to go and input every individual frame's speed. I want to find out a method of doing this once and every animation has the same specific frame speeds. Note, the frameRATE is not what i'm trying to do. I was thinking doing this by instance variables but this is where I get stuck on my idea, which is this:

    To have an object called "FrameSpeedz", and create an instance variable for each animation. So for "run", an instance variable titled "run" and have its value as text, describing the speed of each frame. If run had 5 frames let's say, then i'd want the text to show the frame speeds for each frame separated by a comma. I'll demonstrate my thoughts

    Here's the speeds of the run animation.

    Frame 1 = Speed of 3

    Frame 2 = Speed of 2

    Frame 3 = Speed of 5

    Frame 4 = Speed of 4

    Frame 5 = Speed of 9

    And so I'd want to input the instance variable's value like this "3, 2, 5, 4, 9".

    But that's where I get stuck because I don't know how to create an event that would make this work...but you see my idea? An event the Character family would utilize and thus all sprites in that family have the same frame speeds. Thanks for reading this far, could you please suggest some ideas? I'd prefer explaining and not just post a demo capx because sometimes I am away from my computer and on my phone. Thanks!

  • Bump

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Bunp

  • I guess if you want to use a string containing all the different frames you could use the Token at expression..

    tokenat(src, index, separator)

    Return the Nth token from src, splitting the string by separator. For example, tokenat("apples|oranges|bananas", 1, "|") returns oranges.

  • Having said that, I don't believe there is an action to set framespeed directly..

    You can however set the frame and the animationspeed

    I guess you'd have to create a new animation-system by which you set the animationspeed per frame..

    Wouldn't it be easier to clone the first object with all it's animation adn framespeeds and replace the animationframe-sprites with the different ones?

    And if a large part of the sprite is the same and only the things in the hand change, why not make an overlay sprite and crop away all that is the same?

  • Cloning and replacing images does sound a LOT more better of an idea... I haven't done it before, does it still maintain the individual frames' speeds?

    Also, could you go a little further on how the token expression works?

  • It should maintain everything..

    The above about the tokenat expression was taken from the manual..

    by indicating what number(index) fram a string(src) seperated by something(seperator)

    the string could be "1,2,3" - the seperator here is "," so if you ask for TokenAt("1,2,3",2,",") you'll get 2

  • What would be the best way to replace all the frames of an animation? Because the only way I see is cloning it in construct then exiting it, and in the project folder replace the frames in the clone. Except that requires a lot of renaming so that the name matches the number for it to be read in construct.

  • why would you exit construct?

    clone the object open it up in the image editor and start replacing..

  • replacing it that way would require replacing one frame at a time thooo

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)