Jump to content
Monkey_Balls

Animation inside animation? Construct 2 sprite loops

Recommended Posts

Hi there! I'm working on Spriter with Construct 2 for a project, and I was wondering if you can have an animated sprite along with the imported spriter animation on C2.

Example: I've made a character's animations (walk, jump, etc), and imported it to C2, but I want him to have a blink cycle independently. I've tried to take the imported eye sprite and insert blink animation, but there seems to be no way to make the imported sprite to play other frames. I've also tried to make a sprite inside C2 with the animation, and pin it to the eye object, but it got a weird delayed follow effect.

Any suggestions?

Thanks so much.

Share this post


Link to post
Share on other sites

The easiest way I can think of to get the effect you're after is by switching the animations off of loop mode in Spriter, and create a clone of each one with a blink in it, and add events in C2 which randomize whether or not it plays the blinking version or the non blinking version.

I know its a little tricky, but the best way to ensure you don't have the issues you've been running into by using other methods.

The Spriter plug-in for C2 does now allow for intercepting and overriding specific things, but I've not used those features yet.. its possible you could do something that way as well.

cheers,
Mike at BrashMonkey

Share this post


Link to post
Share on other sites

I've downloaded the latest plugin... will run some tests and post if I come out with something cool.

I'm still wondering why I can't get the imported sprite of the eyes and draw more frames to it, and make it play.

Definetly would be the easiest way xD

Thanks!

Share this post


Link to post
Share on other sites

It's not possible to just try and force the sprite of the head or eye to animate via standard c2 events (because the Spriter object has full control of what frame its displaying based on the actual animation data at every screen update), HOWEVER you might be able to do so with the new overriding actions that Edgar recently added. I'm afraid I'm never used them and am too buried in other obligations atm to learn them.

cheers.
-Mike at BrashMonkey

Share this post


Link to post
Share on other sites

Hey man, I've tried playing around with the override functions you've mentioned... I didn't find much content about it, could you point some to me?

I've tried some things, but no results.
I've decided to do the blink inside spriter normally.

However, I've stumbled with another issue that fits in the same title here.
I have this character (the one of my avatar), and it has a smoke that has it's own animation (about 15 frames).
I wanted it to follow the head (with locked angle) while having these 15 frames changing in loop independently.

Is there anyway to have this done inside Spriter without switching the frames one by one every 25 miliseconds or so? Like importing a gif maybe, orsetting a folder as image sequence?
If not, any tips how I could have this effect on my game? The pinning I've mentioned before almost works, but it behaves with a weird delay.

Thanks so much for your atention.

Share this post


Link to post
Share on other sites

Hi Mike,

I've uploaded a simple test to tinker with this problem.
https://dl.dropboxusercontent.com/u/72624361/Construct/smokeProblem/index.html

I've noticed that the pin behaviour (or any kind of update position method) always have this delay when pinned to anything imported from Spriter.
Any idea how to get around with this delay? I know you suggested a good idea for the eyes problem, but pinning objects inside C2 would be the best solution for other necessities similar to this.

Pelase help xD
Thanks so much

Share this post


Link to post
Share on other sites

Hi @Monkey_Balls To override the blinking animation, try using the Override Animation action.  For object name, put the eye sprite's object name (the name it has in Spriter), and choose to override the component 'image frame', and then for value, choose the frame number you want to display.

For your other issue with the smoke lagging behind the rest of the object, a potential workaround was found here (https://www.scirra.com/forum/viewtopic.php?f=146&t=167801&p=1015979#p1015979), but I think I have an idea for something that could be added to the plugin to make it easier.  Please keep a lookout in the main Spriter plugin thread on Scirra forums for updates on that.

Share this post


Link to post
Share on other sites

Hey lucid,

I've tried the Override animation as you said, but it only changes the sprite for one frame and return to the first frame.
Is this how it works? I can work around some solutions to have more blinking time, but not sure if I did something wrong.

About the smoke, I've tested updating the position at the beggining and end of the script, and it gets delayed all the same.
But I'm very interested in this sub enteties you've mentioned. I assume its something like having a second entity or scml accompanying the main animation with a sub routine. Please let me know if there is a workaround on spriter for that.

I've started making the smoke loops inside spriter, changing the sprite every 20 ms or so... but it's a pain in the ass to work like that, and it doesn't get the perfect need ;)

Thanks so much

Share this post


Link to post
Share on other sites

Hi @lucid,

I've stumbled with an issue related with the need posted here.
I've made the blinking using the override animation and it worked great.

So I kept on working with the same idea, but it prompts an error with some other sprites.

I'm attaching a test capx where the "eyes1" sprite has the blinking effect working, but the object "head" has the same logic in a press space event and it gives an error messege.

I'm suspecting I'm making some mistake, but no idea what it could be.

Thanks!

animOverrProblem.capx

Share this post


Link to post
Share on other sites

Could you please send me the Spriter project folder (the one in C2 changes the image names so I can't load it in Spriter)?  I see what's causing the issue in the Spriter file, but I can't troubleshoot why it's happening without being able to load it and reimport it into C2.

Share this post


Link to post
Share on other sites

@Monkey_Balls Found the issue.  I've updated the plugin so it doesn't get an error.

However, if you want C2 to use any default pivot points for the images you replace with requires a simple workaround (currently it looks like you don't have any default pivot points set for the head image files so you won't need this workaround unless and until you do).  The "head" sprite object has to use each image you want to be able to use as a replacement image in Construct 2 at least once in the Spriter project.  You can just make an animation you never use in C2, with just the "head" by itself, and it cycles through each head image you'll be using, and that would be enough.  After doing so, reimport the Spriter project into C2.

It looks like you manually added the frame of animation for the monkey's head, or that it was present in the scml on a previous import, and not reimported into C2 after changing it.  In any case, the issue is that Spriter makes a list of images to use for each sprite that C2 reads when importing.  It uses the same list at runtime to remember image sizes and pivot points.  So if you manually add a frame in C2, and you tell it to change to frame 1, and it wasn't in this list, the plugin doesn't have access to the sprite image or filename in order to figure out which image was placed there.   Also note, that if the keyframe has a non-default pivot point set just for that frame, you don't need the workaround, but in this case it seems it will be needed to keep the monkey's head aligned correctly (more info on using default pivot points here).
 

Please let me know if that solved your problem.

Share this post


Link to post
Share on other sites

@lucid I believe for the monkey i've kept all the pivots at default, worked only with bones. But I'll surely keep that in mind for future animations, since this method is providing interesting ideas here.

Have you noticed how I've made the blinking eye? Would you say this method has any issues or it could work better somehow? The use of the "wait" actions feels a little rough, but couldn't think a better way.

Thanks so much to you and Mike, your attencion has been amazing around my needs =]

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...