Exile03330 Posted September 18, 2015 Report Posted September 18, 2015 Hello, I posted this topic in the Scirra forums too. (https://www.scirra.com/forum/viewtopic.php?t=154034) Does anyone have an example of using the Spriter animation variables with Construct 2? I am able to get Events to trigger in C2 and tags to work. However, I am having trouble getting expected variable values. The variables that I set are in the meta data section at the bottom of the time line. Oh at one point I had an integer that for some reason incremented throughout the animation, but I dont know why. All I did was change the current value a couple different times on key frames. I am trying to have an Event fire a couple time throughout the animation and on the same key frame to change a variable. So in C2 I can get the variable value when it changes with the Event trigger. An example with a couple variable types that change over the animation would be greatly appreciated or a link to an example capx! Thanks! Quote
Mike at BrashMonkey Posted September 18, 2015 Report Posted September 18, 2015 Hi Exile03330, I should be able to look into this, but unforunately not until Monday sometime. Cheers. Quote
Exile03330 Posted September 18, 2015 Author Report Posted September 18, 2015 Oh no problem! I will try to find some time this weekend to upload an example of what I am trying to do. Thanks! Quote
Exile03330 Posted September 20, 2015 Author Report Posted September 20, 2015 I have link to an example that I am having trouble with variables. https://drive.google.com/file/d/0B_14V9jZl-I2ZTN2OU1pWVpHNGs/view?usp=sharing Quote
Mike at BrashMonkey Posted September 21, 2015 Report Posted September 21, 2015 Hi again Exile03330, Here are a few facts which might help you get things working he way you'd like. 1) Numerical variables set in Spriter that are different from each other in different key frames actually TWEEN in value over time from one keyframe to the next. For example, if you have a value called HEAT and its set to zero in the first keyframe and ten in the next keyframe, then halfway between both keyframes the variable HEAT would have a value of 5 2) To retrieve metadata (a variable) from a specific object as opposed to the entire animation then you need the following: .val("mult","UPDATED") just using : .val("mult") looks for a variable in the main animation called "mult" in your Spriter file, which does not exist. 3) Because you already are using a text (string) based variable type in Spriter, you do not need to use the "str()" function in C2, which is used to convert numeric values to strings. 4) IMPORTANT! You found a legitimate bug in the plug-in relating to variables which Edgar has fixed, he'll post the fix shortly. Basically it was what was causing the value of 3 to not trigger at the beginning of the animation. Here's a tweaked capx which/ in combination with the update to the plug-in will fix your issues: https://dl.dropboxusercontent.com/u/61721248/FixedSpriterVariables.capx cheers. Quote
Exile03330 Posted September 21, 2015 Author Report Posted September 21, 2015 Oh great! 1) The TWEEN in value you mention makes sense now :). At one point the integer value shown in the text box was counting up between values, but I wasn't sure why. I didn't realize it is supposed to. 2) Aha, so that's how I can reference that particular value. I noticed you can have the same variable assigned to different objects, but didn't know how to get them. 3) Right, I was doing that because at one point I was trying integers values. 4) Great! Speaking of bugs I have seen another. I can create a new post if need be. Just try to evaluate the Spriter_Object.key action. I wasn't sure what it is supposed to do so I set a text box to display Timer.key. I get an error when I launch it. Using C2 R213. Thanks for all your help! Quote
Recommended Posts
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.