Spriter/C2 - (9-16-2019 - bug fix)

From the Asset Store
Rotate & Animation for 16 Direction & Mouse Direction
  • Sethmaster - interesting. So when you pick a specific instance of a spriter object, you're able to reference all those spriter sprites as well? is that because it's a container?

  • Sethmaster - this looks like it'll be a lot of tedious work to make sure I get every instance selected... but it's definitely a solution

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sethmaster - interesting. So when you pick a specific instance of a spriter object, you're able to reference all those spriter sprites as well? is that because it's a container?

    You got it right

    Sethmaster - this looks like it'll be a lot of tedious work to make sure I get every instance selected... but it's definitely a solution

    If you use it in a function, you only need to do it once, tedious and all, and then reference it whenever you want it to be used.

  • > My thinking was that the new pictures would take on the custom pivot point because they were all the same size as the original art. Regardless, I'll just start over using the bones exclusively. Thanks for your help and all your work on the plugin.

    >

    > -Ben

    >

    You likely don't need to start over. There's a fast way to copy your pivot points to images of same name and same size. (if they are in a different sub-folder as the original images.)

    look here : https://brashmonkey.com/spriter_manual/ ... ffects.htm

    At the bold text just before step 3

    cheers.

    -Mike at BrashMonkey

    lucid and I checked out the link provided and it seemed like it was the steps for creating a new Character Map and didn't mention carrying over the new default pivot points.

    Regardless, I did another test and edited the pivot points on the layout (which is actually my preferred way of working) and not by double clicking the objects and setting before importing. The new test worked perfectly so that is how I will do it. I wasn't too far into the animations so I can just start over.

    Thanks for your help. I'm looking forward to getting it finished and up for people to use.

    -Ben

  • Hello,

    Just wanted some clarification—Spriter supports animated hitboxes, sound effects, and most if not all other features when importing into C2? Meaning I don't have to manually add in sound effect timing etc. in Construct? (Sorry if this has been answered before—couldn't find a clear answer after 20 minutes or so and I figured asking would be easier than searching this entire thread...)

    Thank you~

  • BBaller1337, here you go

    Subscribe to Construct videos now
  • EDIT: If your project was created with an older version of the plugin, and you want to continue to use the old mode for the plugin, you will get an error when you launch C2. Please download this version of the plugin if you don't plan to convert your project to the new mode. I am checking into whether there is a way to get the edittime to load without errors even without converting, and if I can find a way, I will update the plugin accordingly.

    thanks BBaller1337, yes it supports all non-experimental features (everything except deformation), though sub-entities currently have a manual import process I can repost here if you need it.

    everyone - the performance mode/self drawing update is here

    It requires the new version of Spriter Pro (or auto-update your current version)

    The download for the plugin is here.

    Again, consider the new mode to be in a beta state, until it's had some time to get tested more extensively by the Scirra community.

    To use the new direct drawing mode. Use the following steps:

    • In Spriter, make sure your project is already saved normally.
    • Go to File|Generate spritesheets for project images
    • Select a different folder from your current Spriter project folder to save your spritesheeted project
    • Make sure 'padding' is set to at least 1 pixel or C2's linear smoothing will cause images to bleed into eachother
    • Make sure 'save spritesheeted project' is checked
    • Make sure 'save as scon' is checked
    • Make sure 'embed spritesheet info in project file' is checked
    • Make sure you keep the 'multiple spritesheets' setting to 'Never generate multiple spritesheets' (default setting)
    • All of the above settings (with the exception of the output folder) will be saved after the first time you use them
    • Create a new project with C2
    • Add an scml object in the same way you would any other C2 object (do not drag the scml file into your layout)
    • When the image dialog pops up (or double click the scml object to open it), choose the generated spritesheet image from the output folder you selected
    • In C2's project pane, right-click on 'Files', and select 'Import Files', and choose the scon file from the output folder you selected
    • Select the scml object, and in the object properties pane, for SCML file, type in the filename of your scon file
    • Set 'draw self' to 'true'
    • Run your project, and report any issues or bugs to this thread.

    To change your existing project to use the new direct drawing mode:

    • Follow all of the above steps until you get to the part where you would start a new C2 project.
    • BACK UP YOUR CURRENT PROJECT TO A NEW FILENAME IN CASE ANYTHING GOES WRONG
    • Remove all the sprite objects associated with your Spriter object from the project
    • Remove the previously generated initialization event from your project
    • Remove the previously imported scml and scon file from your project
    • Start from the step above where you double click your scml object to choose the spritesheet image
    • If your project was started with the previous version of the plugin you will most likely get an error when you run it. This has to do with the previous version of the plugin having no image. To fix this, simply save your project, and reload it.

    Enjoy! Hope this comes in handy.

  • lucid - hey man, this works great. you also forgot to add that weg gl effects work also those weird extra sprites that were showing up in the corner of the level are gone too. nice work guys!

    I did run in to an issue when I was trying to convert an existing spriter object over to the new format. I seemed to narrow the problem down to when I loaded the sprite sheet in. here are some screenshots of the two errors I got (in chrome):

    since I'm using families for my enemies, I was just able to create a new object and follow the steps and everything worked fine. it's not a huge issue for me to work around it this way, but either way I hope this helps!

  • lucid - one more quick question, every time I edit my scml files, do I need to edit the non-spritesheet versions and then save them as sprite sheet projects each time?

  • mudmask - Thanks, I will look into those bugs. And yes, you do have to edit the non-spritesheet versions and save as spritesheeted each you want to reimport.

  • Thanks for the earlier response, I've been playing around and got a lot of things to work, and it's great so far. Unfortunately I have run into some concerns.

    f?i?r?s?t?,? ?n?o?t?e? ?t?h?a?t? ?I? ?s?e?n?t? ?a?n? ?e?-?m?a?i?l? ?a?b?o?u?t? ?t?h?i?s? ?t?o? ?s?u?p?p?o?r?t? ?a?l?r?e?a?d?y?,? ?j?u?s?t? ?p?o?s?t?i?n?g? ?a? ?b?i?t? ?i?n? ?a? ?p?u?b?l?i?c? ?m?a?n?n?e?r?.? ?T?h?e? ?p?l?u?s?-?s?i?d?e? ?i?s? ?t?h?i?s? ?c?o?u?l?d? ?h?e?l?p? ?o?t?h?e?r?s? ?o?r? ?I? ?c?o?u?l?d? ?g?e?t? ?o?t?h?e?r? ?p?e?o?p?l?e?'?s? ?f?e?e?d?b?a?c?k?,? ?t?h?e? ?d?o?w?n?-?s?i?d?e? ?i?s? ?t?h?a?t? ?i?t?'?s? ?a? ?p?r?i?v?a?t?e? ?p?r?o?j?e?c?t? ?w?i?t?h? ?c?o?n?f?i?d?e?n?t?i?a?l? ?i?n?f?o? ?a?n?d? ?a?r?t? ?s?o? ?I? ?c?a?n?'?t? ?s?h?a?r?e? ?t?h?e? ?C?A?P?X?.? OK, apparently I can't get help through private channels, so I have to go off messy explanations since I cannot publicly share screenshots or the CAPX or anything.

    Anyway, I'm trying to figure out how to set up enemies in my 2D action game. In it, you can attack with one character and hit an enemy. I figured having a family for all enemies with common instance variables and behaviors would be a good idea, so I did that. For the object, I set it to the SCML one. Probably I'll do it so that each enemy has its own scml file, for about 20 different enemy types (including bosses).

    The issue is that the SCML objects have their own collision box and this is used by Construct 2 for:

    • general collision detection, of course
    • shadows (shadow light object + shadow caster behavior)
    • interactions between solid objects

    When checking interactions between two objects with the "solid" behavior, C2 uses the collision mask of the object with the behavior. I can adjust this slightly by linking the scml to another object and changing said object, but in the end its collision mask is not going to match every frame of every animation--it's just going to be something static. So... what am I supposed to do if an enemy is say, lying down on the ground or in some other pose where their shape changes dramatically and a single rough & static collision mask won't fit the object?

    Shadow issue is basically the same thing from what I can see, just a different application. It's using the SCML object (or in the player character's case, the sprite object that is pinned to the SCML object) and using that to draw shadows.

    I tried maaaaany different things and did hours of researching or I wouldn't bother rambling about my problem here. There were issues with putting the shadow caster behaviors on many different places (such as the sprites) and I think it's just going to be difficult to handle this when it's not integrated into the Spriter object behavior and I don't fully understand how exactly the Spriter object does what it does.

    I could do without shadows, but objects not having solid behaviors would just look and function oddly. As for the collisions, it's extremely confusing and I'm not sure what to do but at least I have control over the interactions, unlike the Solid behavior.

    Thanks for any advice/help anyone can offer.

    UPDATE: After a ton of thinking, research, and coding, I managed to work around the collision boxes issue by using families, containers, and some crazy code and as of right now I think I've got everything working, though it needs more testing. I still haven't fixed the issue with the solid or shadow caster behaviors though.

    I also have some issues with Spriter I'd like report... hopefully it's just me being bad, which it usually is.

    Spriter Issues

    Sometimes renaming files at the top-left doesn't work, if I try to like, rename something and then rename another thing. I haven't been able to figure out what exactly causes or fixes the issue but it can be somewhat inconvenient when I keep double-clicking and it won't rename. Maybe there is some trick to it I'm missing or maybe it's a bug, I don't know.

    Meta data: when I adjust basically anything in the timeline, the existing meta data I have (just tags for now, but I want to try out variables in C2 as well, since I haven't found anything on how they work) just disappears. The key frames for them or whatever disappear and I have to re-add them, which is... well, obviously not cool.

    I feel like I'm doing something wrong in adjusting the tags, but I can't figure out what. :

    As always, thanks for any help.

    Update 2: Meta tags just... aren't working for me. Aside from being glitchy in Spriter, after several hours and various code tests I cannot get the different tags to function correctly in C2 either. I checked the JSON file and it seems like it's right (though I couldn't tell you confidently without a little more info about the format) but I'm just having no luck.

  • BBaller1337, I'll look into everything you mentioned.

    mudmask, we were able to replicate the issue. The issue was from projects created with the previous version of the plugin. The simple fix is to save your project (to a new filename just to make sure), and then close it, and reload it. After saving and reloading, it should work fine.

  • lucid Thanks for the update.

    I've been doing almost nothing but trying to fix this since, here's my end:

    I managed to get shadows working by adding the shadow caster object to the sprite objects, having it disabled by default, and then enabling it when an animation was active (I used a "IsVisible" check for this to keep things super simple; I'm not sure how well this would have worked in the long-run). However, I ultimately didn't like the result and opted for a very different (and less costly) implementation of shadows.

    EDIT: I originally said I got the solid behavior working but I spoke too soon and was wrong about getting a solution to the solid behavior functionality. It's actually still not working. Worst-case scenario it's super glitchy and the main character goes flying around, lol. I guess the next paragraph doesn't apply as much since said solution doesn't work but.....

    The downside to this solution is that A) it's time-consuming to make sure everything is set up and functioning correctly and B) it'd probably be more efficient and less prone to glitching if the SCML objects inherently used the collision or hurt boxes of the animations its loading, so if you have any suggestions or anything, I'd appreciate it.

    Also, quick question: what does changing the .scml extension to .scon for the SCML object actually do? I've forgotten to do it a few times but haven't noticed anything. Thought it might be the cause of some issues but after going and back and double-checking I didn't see any differences.

    As a note, I still couldn't get tags to work in C2 and gave up for a while—I did eventually look into it but couldn't find an issue in the plugin's runtime code. Then again, I didn't understand the code super well or anything, so I'll leave it to the pros... especially since the Spriter issue with the disappearing key tags isn't really work-aroundable

    EDIT2: Got around to testing triggers and they work perfectly and it felt great. I just used those as a substitute for tags since they can basically do the same things, they're just maybe slightly less convenient or efficient.

  • Hi Bballer1337, (replies inline)

    Thanks for the earlier response, I've been playing around and got a lot of things to work, and it's great so far. Unfortunately I have run into some concerns.

    "f?i?r?s?t?,? ?n?o?t?e? ?t?h?a?t? ?I? ?s?e?n?t? ?a?n? ?e?-?m?a?i?l? ?a?b?o?u?t? ?t?h?i?s? ?t?o? ?s?u?p?p?o?r?t? ?a?l?r?e?a?d?y?,? ?j?u?s?t? ?p?o?s?t?i?n?g? ?a? ?b?i?t? ?i?n? ?a? ?p?u?b?l?i?c? ?m?a?n?n?e?r?.? ?T?h?e? ?p?l?u?s?-?s?i?d?e? ?i?s? ?t?h?i?s? ?c?o?u?l?d? ?h?e?l?p? ?o?t?h?e?r?s? ?o?r? ?I? ?c?o?u?l?d? ?g?e?t? ?o?t?h?e?r? ?p?e?o?p?l?e?'?s? ?f?e?e?d?b?a?c?k?,? ?t?h?e? ?d?o?w?n?-?s?i?d?e? ?i?s? ?t?h?a?t? ?i?t?'?s? ?a? ?p?r?i?v?a?t?e? ?p?r?o?j?e?c?t? ?w?i?t?h? ?c?o?n?f?i?d?e?n?t?i?a?l? ?i?n?f?o? ?a?n?d? ?a?r?t? ?s?o? ?I? ?c?a?n?'?t? ?s?h?a?r?e? ?t?h?e? ?C?A?P?X?.? OK, apparently I can't get help through private channels, so I have to go off messy explanations since I cannot publicly share screenshots or the CAPX or anything."

    You certainly can get help through private channels, but some times it takes time for us to be able to help. It would make things go as quickly as possible if you share your project files with Edgar (Spriter's programmer) so we can directly look into all aspects of the data and code related to the problems.

    "Anyway, I'm trying to figure out how to set up enemies in my 2D action game. In it, you can attack with one character and hit an enemy. I figured having a family for all enemies with common instance variables and behaviors would be a good idea, so I did that. For the object, I set it to the SCML one. Probably I'll do it so that each enemy has its own scml file, for about 20 different enemy types (including bosses)."

    Please take the time to be extra-redundant with your explanations.... this is complicated stuff, and very easy to misunderstand...especially once you start using words like "it" after having mentioned multiple things just previously. In this case, you say, "for the object".. which object? When you say you set "it" to the SCML one.. what do you set, and to which scml one?

    "The issue is that the SCML objects have their own collision box and this is used by Construct 2 for:

    • general collision detection, of course
    • shadows (shadow light object + shadow caster behavior)
    • interactions between solid objects"

    Are you referring to collision boxes that you can manually add to Spriter animations, or some kind of C2 generated "bounding box?"

    "When checking interactions between two objects with the "solid" behavior, C2 uses the collision mask of the object with the behavior. I can adjust this slightly by linking the scml to another object and changing said object, but in the end its collision mask is not going to match every frame of every animation--it's just going to be something static. So... what am I supposed to do if an enemy is say, lying down on the ground or in some other pose where their shape changes dramatically and a single rough & static collision mask won't fit the object?"

    It depends enormously on what type of game you're making. I think you'd be amazed at how basic such collision shapes and coding was for all classic action/platformer games. You'd really have to explain in more detail what you're after... can players jump on top of enemies who are lying on the ground? What is your desired effect?

    "Shadow issue is basically the same thing from what I can see, just a different application. It's using the SCML object (or in the player character's case, the sprite object that is pinned to the SCML object) and using that to draw shadows."

    Again, we'd really need to be visual examples of your desired effect. Is this game overhead, isometric, or side scroller, for example? What's happening with these shadows and how accurate/detailed does their shapes have to be?

    "I tried maaaaany different things and did hours of researching or I wouldn't bother rambling about my problem here. There were issues with putting the shadow caster behaviors on many different places (such as the sprites) and I think it's just going to be difficult to handle this when it's not integrated into the Spriter object behavior and I don't fully understand how exactly the Spriter object does what it does."

    We really need to know exactly what desired effect you're after before we can explore possible solutions.

    "I could do without shadows, but objects not having solid behaviors would just look and function oddly. As for the collisions, it's extremely confusing and I'm not sure what to do but at least I have control over the interactions, unlike the Solid behavior."

    I'm not sure what you're after, behaviorally and visually in game, so can't offer useful advice.

    "UPDATE: After a ton of thinking, research, and coding, I managed to work around the collision boxes issue by using families, containers, and some crazy code and as of right now I think I've got everything working, though it needs more testing. I still haven't fixed the issue with the solid or shadow caster behaviors though."

    Glad you're making some progress, but we can't help without much more detailed info regarding your desired results.

    "I also have some issues with Spriter I'd like report... hopefully it's just me being bad, which it usually is.

    Spriter Issues

    Sometimes renaming files at the top-left doesn't work, if I try to like, rename something and then rename another thing. I haven't been able to figure out what exactly causes or fixes the issue but it can be somewhat inconvenient when I keep double-clicking and it won't rename. Maybe there is some trick to it I'm missing or maybe it's a bug, I don't know."

    WOW! I never knew you could rename sprites in the z-order palette, BUT don't understand any reason to do it,as it does not rename the file itself. I think the very ability to rename it there is a bug and not a feature. I suggest you avoid renaming images in the z-order palette. However in the Hierarchy palette I can see how renaming bones is useful.

    " Meta data: when I adjust basically anything in the timeline, the existing meta data I have (just tags for now, but I want to try out variables in C2 as well, since I haven't found anything on how they work) just disappears. The key frames for them or whatever disappear and I have to re-add them, which is... well, obviously not cool."

    Could you possible make a screen recording of this happening. it might be user error and might be a bug, and either way, footage of it happening will help us resolve it.

    "I feel like I'm doing something wrong in adjusting the tags, but I can't figure out what. :

    As always, thanks for any help."

    We'll certainly do our best to help you resolve all these issues. Again, privately sending us your project is the fastest way to get concrete help.

    "Update 2: Meta tags just... aren't working for me. Aside from being glitchy in Spriter, after several hours and various code tests I cannot get the different tags to function correctly in C2 either. I checked the JSON file and it seems like it's right (though I couldn't tell you confidently without a little more info about the format) but I'm just having no luck."

    I've had both features work for me perfectly in Spriter and in C2, so we really need to see exactly what you're doing and whats happening to figure out the problem. It certainly could be a bug or bugs we just managed to accidentally avoid through different work flow etc. Hopefully we can find out together and quickly resolve it.

    cheers.

    -Mike at BrashMonkey

  • help, Gotcha

    , I apologize. Not my strong point, I'll work on being clearer.

    paragraph: C2 generated bounding box. I'm saying the SCML objects use this, of size 50x50 by default. I can change it to another sprite, but I can't naturally make it use the collisions of the Spriter animations that I set in Spriter.

    paragraph: Take a character standing up.

    ||

    ||

    ||

    Let's say this is their collision box. I think you get the idea: it's tall and skinny. Now, if I pin the scml object to a sprite object, and make the sprite object have a collision box of this shape, I now have a character with this static collision box.

    However, it's just that: static. If I use the spriter object to change the animation, the collision box does not change to match it. So if an animation is now the opposite, short and wide:

    =======

    The collision box and the animation do not match, creating an issue in the game. I could maybe hard code collision boxes for every situation, but this would be very, very time-consuming and defeat the purpose of using Spriter.

    Hopefully this makes the inherent issue clear.

    For the next paragraphs: not much to say since I wasn't able to get the issue across. Admittedly, I have clear visuals and you don't so that's reasonable. I did originally send a CAPX to you for that reason but I get that Edgar is the person to go to for C2 so I shall e-mail him when I get a chance.

    Going to start quoting to help keep order, with quotes being in bold:

    WOW! I never knew you could rename sprites in the z-order palette, BUT don't understand any reason to do it,as it does not rename the file itself. I think the very ability to rename it there is a bug and not a feature. I suggest you avoid renaming images in the z-order palette. However in the Hierarchy palette I can see how renaming bones is useful.

    • Huh, really? Interesting. I actually vaguely remember being told to do this, though it may have been elsewhere. I renamed them because it's useful to me to give the objects names that mean something to me and are consistent with my general naming schemes (and thus predictable and easy to recognize). These names are used by Construct 2 as well, making them all the more important. (I'm not using bones for this project though.)

    Could you possible make a screen recording of this happening. it might be user error and might be a bug, and either way, footage of it happening will help us resolve it.

    Yup, no problem. Will do shortly.

    "We'll certainly do our best to help you resolve all these issues. Again, privately sending us your project is the fastest way to get concrete help."

    Thank you for the reassurance. As said, I shall send it again shortly.

    I've had both features work for me perfectly in Spriter and in C2, so we really need to see exactly what you're doing and whats happening to figure out the problem. It certainly could be a bug or bugs we just managed to accidentally avoid through different work flow etc. Hopefully we can find out together and quickly resolve it.

    Haha, I kind of figured posting nothing but text wouldn't be useful but you were the one who told me to post on forums (though you did mean the other ones, but same diff). Perhaps you didn't make the connection between the two identities though—regardless, it's all good and I'll email shortly.

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