Seeking help on how to load+play animations externally - for dummies

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Hi all,

    As the title suggests, I'm a bit stumped when it comes to loading in frames to play an animation externally.
    As far as I can grasp, an active object can load in frames, but I'm struggling to understand how to play said sequence of frames during runtime.

    The most progress I've made so far is loading in a single frame...

    I found a few threads which touched on using strings and loops, but the formulae used gave me more questions than answers. Strings are definitely not my strong point.
    If anyone has the time to give a simple rundown on how to get an animation loaded and running, I'd be super grateful X)

  • You play the animations just the same way you play any animation (ie. They play on their own; if you stop them manually you then need to "restore animation frame")

    But unfortunately, you can't *add* new frames to an active. You can only replace existing frames. So if you want to load in 7 frames from 7 files, you have to first put 7 dummy frames in that object in the Frame editor. Perhaps that's what's tripping you up?

    Please login to see this link.
    My Fusion Tools: Please login to see this link. | Please login to see this link. | Please login to see this link.

  • Hey Volnaiskra,

    Ah I guess I'm confused about playing them. Once I "load frame", ie. idle01.png, how do I then load idle02.png ? Literally at the starting line when it comes to this. As I try to use loops sparingly, wont I need a never ending loop to play a looping animation?

    I do get the idea about dummy frames however, that doesn't seem too much of an issue in all fairness.

  • No sweat. Ok, just to make sure we're on the same page here, we first do "load frame" like this:

    Please login to see this picture.

    Fusion then pops up a windows file selector box, and we choose our first file:

    Please login to see this picture.

    It then asks you which "animation" (aka animation sequence) to place the file in. Let's say you select "stopped".

    It then asks you for the starting direction. Let's say you're happy with the default, which is direction 0, so you click OK.

    Now is the key part: it asks you "which frame to display". This is confusing wording, actually. What it really means is 'which frame of this active object do you want me to load your file into?". For this file, let's choose the first frame, which is frame 0 (then keep pressing ENTER for all the subsequent dialogs):

    Please login to see this picture.

    Now let's do the next frame. We repeat the same process, but this time we choose a different file:

    Please login to see this picture.

    We choose the same animation [aka animation sequence] as before ("stopped", in this example) and the same direction as before (0 in this example). When it gets to the part where it asks for the frame, we choose the next frame, which is 1:

    Please login to see this picture.

    Then we hit enter on all the subsequent dialogs. So, we've now loaded idle01.png into frame 0, and idle02.png into frame 1. You can keep going like this, loading idle03.png into load frame 2 and so on. If you have a gazillion files to load in, you'll want to automate the process somewhat using strings and fastloops. Or you can just do it manually, as I've described here. The final events will look something like this:

    Please login to see this picture.

    Now, the frames are loaded in, for good. You don't need to load them in again. They are now part of the active object, as if you had inserted them manually using the Frame Editor. As long as you've set this particular Active Object to "loop", as shown below, these new frames will loop continuously

    Please login to see this picture.

    If anything's unclear, just keep asking questions :)

    Please login to see this link.
    My Fusion Tools: Please login to see this link. | Please login to see this link. | Please login to see this link.

  • This is extremely helpful Volnaiskra, thank you for taking the time to even get screenshots of the process.
    True boon to the community.

    I'm definitely going to be using this going forward in my game.

    If you don't mind me asking, could you help on how I would go about automating this as well?
    Some of my enemy sprites have over 30 frames per animation.

    It's pretty incredible that you can do this; I honestly had no idea this was possible until recently haha, oops.

  • No problem. It's very quick for me to put screenshots on the forum. It's literally two keypresses: I've set up Please login to see this link. so that with one hotkey, it screengrabs a region, uploads it to imgur, shortens the resulting URL, then copies that URL to clipboard. Then I press a macro key on my keyboard which pastes the URL onto the forums and puts Please login to see this picture.


    And this is what we do to import them (no, I won't attach the MFA because you'll learn better by recreating the steps yourself):


    Please login to see this picture.


    So, let's take it from the start. We first run a fastloop (that we've called "ImportSomeStuff") 12 times, since we have 12 files to import:

    Please login to see this picture.

    For now, let's ignore the LoopIndex("ImportSomeStuff") <10 bit. So, we have this:

    Please login to see this picture.


    The action in this event is basically the same as what I showed yesterday, but it has new, dynamic info in the "file" portion. To do this, we repeat the start of the process as before, but instead of selecting a file, you hit "use expression":

    Please login to see this picture.

    This takes us to the expression editor, where it asks for the filename:

    Please login to see this picture.

    Now, you could just give Fusion the full path of your filenames, like this:

    Please login to see this picture.

    And if this game is only for your use, then you may as well. But if you're going to share the game with anyone, then they're not going to have those files in exactly the same location as you, so you'll need a relative pathname, not an absolute one. Let's say that you'll put the files into a folder called "images" that's inside the same folder as your MFA (or EXE) file. So, our first job is to tell Fusion to go to [the MFA application directory, wherever that may be]. We do that like this:

    Please login to see this picture.

    Don't worry, you don't need to remember that code in the future. Just find it in the Special Object under "filenames" like this:

    Please login to see this picture.

    To be honest, I don't know what the difference between "Application directory" and "application pathname" is, but I always use "application pathname" and it works.

    OK, so Apppath$ will tell fusion to go to the folder where your MFA (or EXE) is. Now, we need to tell it to go to a subfolder called "images" that's inside there. So we add this bit:

    Please login to see this picture.

    Now, the first file that we want is called idle00.png, so we need to add that. But, we're automating this, so we don't just want to import idle00.png, but we also want to import idle01.png, idle02.png and so on. So, we split these filenames into two parts: the part that is always the same (idle0*.png) and the part that is always different (eg. idle03.png). So, first we add the bits that are always the same:

    Please login to see this picture.

    And now is the trickier bit, where we need to add the ever-changing number that goes in the middle there. OK, so we're running the fastloop 12 times, and we need a way to tell fusion a different number each time, from 0 to 11. Well, while Fusion runs this fastloop, it quietly keeps track of how many times it's already run it, using a value called loopindex. So, each time the fastloop called "ImportSomeStuff" runs, LoopIndex("ImportSomeStuff") will increase by 1....from 0 to 11. Those are exactly the numbers we want. So we just put LoopIndex("ImportSomeStuff") into our expression, like this:

    Please login to see this picture.

    But wait, we're getting an error, because Fusion wants a text (aka string) entry, but we're giving it a combination of text (eg. "images\idle...") and numerical values (eg. LoopIndex("ImportSomeStuff")). So we need to convert the numerical bit into text as well. That's easy enough - we just need to put it inside Str$( ). So, our final expression looks like this:

    Please login to see this picture.

    So, Fusion will import 12 frames into this active.

    First, it will import [the MFA application directory, wherever that may be]\images\idle01.png
    Next, it will import [the MFA application directory, wherever that may be]\images\idle02.png
    Next, it will import [the MFA application directory, wherever that may be]\images\idle03.png
    ....and so on, until...
    finally, it will import [the MFA application directory, wherever that may be]\images\idle011.png

    Uh oh. But our file isn't called idle011.png. It's called idle11.png, without the zero. OK, now we go back to the LoopIndex("ImportSomeStuff") <10 bit that I told you to ignore earlier. We'll add some conditions to our fastloop, to tell Fusion to use a slightly different expression depending on whether we're importing files 0-9, or files 10+ (see the yellow bits):

    Please login to see this picture.

    So, for the first 10 iterations of the fastloop, our expression contains an extra zero, and for all subsequent fastloops, it doesn't (which will make it work as desired all the way up to idle99.png)

    Now, one final thing. We've told Fusion to load a different file each iteration of the loop. But we also have to tell it to load those files into different frames of our active. So when it asks us which "frame to display" (again, that vague and somewhat misleading wording):

    Please login to see this picture.

    We use our old friend LoopIndex("ImportSomeStuff") to tell it to import each file into a different frame (frame 0, then frame 1, then frame 2...etc.)

    Please login to see this picture.

    Which leaves us with the final result:

    Please login to see this picture.

    Please login to see this link.
    My Fusion Tools: Please login to see this link. | Please login to see this link. | Please login to see this link.

  • Well thats a very handy shortcut haha, kudos, I'm learning quite a lot in here.

    Thanks so much for this, you've explained it very well.

    I'm keen to start implementing all of this into the game. And I appreciate you covering all bases as well, I hadn't even figured that you would need to tell Fusion something different for frames after 9. Makes sense though. Converting numerical values to text is a new one for me as well.

    On the note of not sending a file over - I agree, I'd rather do it myself and learn from experience; as I am aiming to release this game commercially.

    But anyway, thanks again; super helpful post. If you were an uber driver I'd rate you 5 stars :cf25+::cf25+::cf25+::cf25+::cf25+:

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!