Animation frame speed by instance variable?

Get help using Construct 2

Post » Sat Jul 26, 2014 12:20 am

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!
B
11
S
2
Posts: 91
Reputation: 1,017

Post » Sat Jul 26, 2014 5:05 pm

Bump
B
11
S
2
Posts: 91
Reputation: 1,017

Post » Sun Jul 27, 2014 9:09 am

Bunp
B
11
S
2
Posts: 91
Reputation: 1,017

Post » Sun Jul 27, 2014 11:02 am

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.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Jul 27, 2014 11:12 am

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?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Jul 27, 2014 5:24 pm

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?
B
11
S
2
Posts: 91
Reputation: 1,017

Post » Sun Jul 27, 2014 5:39 pm

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
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Jul 27, 2014 6:54 pm

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.
B
11
S
2
Posts: 91
Reputation: 1,017

Post » Sun Jul 27, 2014 7:32 pm

why would you exit construct?

clone the object open it up in the image editor and start replacing..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Jul 27, 2014 7:40 pm

replacing it that way would require replacing one frame at a time thooo
B
11
S
2
Posts: 91
Reputation: 1,017


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests