User Tag List

Results 1 to 7 of 7

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

  1. #1
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Zebedy's Avatar
    Join Date
    Jul 2016
    Location
    UK
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

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

    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

  2. #2
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,272
    Mentioned
    90 Post(s)
    Tagged
    0 Thread(s)
    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?

  3. #3
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Zebedy's Avatar
    Join Date
    Jul 2016
    Location
    UK
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  4. #4
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,272
    Mentioned
    90 Post(s)
    Tagged
    0 Thread(s)
    No sweat. Ok, just to make sure we're on the same page here, we first do "load frame" like this:



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



    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):



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



    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:



    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:



    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



    If anything's unclear, just keep asking questions

  5. #5
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Zebedy's Avatar
    Join Date
    Jul 2016
    Location
    UK
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  6. #6
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,272
    Mentioned
    90 Post(s)
    Tagged
    0 Thread(s)
    No problem. It's very quick for me to put screenshots on the forum. It's literally two keypresses: I've set up ShareX 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 [IMG] tags around it. The whole process takes me about 3 seconds

    Anyway, automating the image-loading is significantly more complicated, but not outrageously so. First, here are our files:




    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):





    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:



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




    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":



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



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



    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:



    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:



    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:



    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:



    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:



    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:



    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):



    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):



    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.)



    Which leaves us with the final result:


  7. #7
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Zebedy's Avatar
    Join Date
    Jul 2016
    Location
    UK
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

Similar Threads

  1. Load my animations externally
    By kimel28 in forum Fusion 2.5
    Replies: 5
    Last Post: 3rd December 2018, 03:58 AM
  2. How to load animations externally?
    By koolbrosmk in forum Fusion 2.5
    Replies: 3
    Last Post: 28th August 2015, 09:59 PM
  3. How to load animations externally?
    By koolbrosmk in forum Fusion 2.5
    Replies: 0
    Last Post: 27th August 2015, 11:55 PM
  4. Store Player Animations Externally?
    By notjustinbailey in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 26th April 2015, 01:39 AM
  5. Seeking missiles not seeking own acquired targets
    By Kid_Roleplay in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 21st May 2014, 08:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •