How do I Animations from frames

0 favourites
  • 15 posts
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • Its possible create animation only using animation frames?

    For example i have many frames in Default animation

    frame 0 is player idle

    frame 1 &2 walking

    frame 3& 4 attack

    Now i try find way to make animations using this frames

    i create Global variable called animations

    and when global variable is:

    1 - set frame 0 (stand)

    2- set frame 1, 0(walk)

    3 set frame 2, 3 (attack)

    This seems to be easy but this dont work

    when i operate this global variable

    animation frame is always 0

    AND QUESTION number 2

    its possible to create event, this event should operate animation frames just like choose(1,3,5) but i need playinorder(2,3,5,3,2) ?

  • Go through the manual regarding animations...

    You need to Put those frames into seperate Animation groups, i.e other than "Default"

    Then in event sheet actions, select your player sprite and set that animation group to play on trigger

  • signupdemo i dont want create other animations than Default

    i need have all frames in default and picking right frames to play

  • We don't know your project so we can't say for sure, but it looks like you made a bad approach on your feature. There are built-in animations functionalities in C2 which should be enough for you if you plan your feature the right way...

    ...but if your project is so original and you're sure you need to control frames directly then you can simply use Sprite > set frame function. Now to make animation you can use loops or Function + System > wait function. Hard to say what would be the best without knowing what exactly do you need. If you have really small amount of frames then simple Functions should do the job. If it's much more complex then you can even code the sequence in XML or Array and then run some self made generic code to play coded animation sequence.

    In short words there are many ways of achieving what you need but as long as you want to stick to one Sprite animation, then you'll have to make a manual animation with Sprite > set frame.

  • C2 has animation groups for a reason... to make it easier to change between animations, and stop people from asking silly questions about it.

    Unless you have some SUPER SPECIFIC reason to do it the way you did, then you should consider doing it the way it's meant to be done.

    ~Sol

  • I hope this is what you want

  • luckyrawatlucky yes something like that. You use global variables fpr each animation. I do this same thanks

  • SoldjahBoy i need one animation group for one skin of character

    thats better than create families or create new sprite called Enemy 2 and copy events for each created sprite only because i must create animations on standard way.

    All enemies and player's will be on two sprites ONLY on whole peroject

    This way help me save lot of time, lot of CPU usage and not lot of other sprites on project and collision checks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It would be a better solution to use new animations for every skin and animation type. You can add folders to your animations to help you keep organized.

  • glerikud

    if you have animations skin1, skin2, skin3. you should make lot events to steer all addational animations for each skin.

    If you upload all animation frames on skin1.

    and create event to set walking animation and

    even if you change skin on start of layout

    this same events will display walk animation

    I still think this is better way than others

  • If it's just about changing skin of the character and all skins have the same animations names then the proper way would be to create an invisible player sprite which will have all control/movement events and each skins as a separate sprite with proper animations groups.

    Now whenever you need to change the skin you simply spawn the skin sprite on the player sprite and pin it to the player. As all your skins have the same animations (walk, jump, attack, ...) you simply run the set animation function with the proper param ("walk", "jump", ...) in a generic way, so one code will work for all the skins.

    Why do you worry about "copy events for each created sprite"? Events go to player and skins are just animations, so you don't need any control, collision or whatever events on them.

    Also this way you keep the code clean and easily maintainable. If it's a big project then I strongly suggest to focus more on proper code rather than on optimisation which in this case won't give you much advantage if you put all in one sprite. Even more... one sprite with tons of frames (all skins) will be pretty memory consuming for no reason as I assume you will not use all skins in each layout?

  • IGDev

    If you choosing my example and want skin change on this

    then I made this for you

  • Name your animations accordingly. For example for the red skin, name the running animation to red_run. For the blue skin, name the same animation to blue_run. Then use variables to store which skin is active. Then you can call the required animation by building up it's name in an expression: variable_skin&"_run"

  • You don't need to have all animations for one specific character in a single animation group.

    You can have;

    Variable.CharacterType="whatever" (fighter,mage,archer)

    variable.CharacterAction="whatever" (walk,attack)

    Then do:

    set animation -> Variable.CharacterType & Variable.CharacterAction

    "FighterWalk"

    "FighterAttack"

    "MageWalk"

    "MageAttack"

    "ArcherWalk"

    "ArcherAttack"

    ^Possible combinations from one event listed^

    If you have some way to tell the type of character already, then you can simply do it like this and save a lot of headache. I guess the best benefit of it would be if you decide later to add extra animation frames or something - you will be adjusting all kinds of frame numbers and stuff later on.

    ~Sol

  • luckyrawatlucky thanks i think your solution is best because is most siplier and smaller

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