Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14

Thread: Automatically Importing code from other frames?

  1. #1
    No Products Registered

    Join Date
    May 2015
    Posts
    20

    Automatically Importing code from other frames?

    Hey guys, Im making a game where there are 9 frames, (7 Level Frames, 1 Engine Frame, 1 Main Screen,) , So I want it so that when I edit the engine frame's code, It automatically edits the code of the 7 Level Frames, So that if I find a bug or something I can just edit 1 frame instead of 7, Is this possible? Or if not, is there any other ways to do it? Thanks!

  2. #2
    It is not possible to automate this. You have 2 options I can think of to not spread duplicate code across many frames:

    1. You code your levels and engine in a single frame. This means the engine will load level data from some external source (array, text file, etc) and create the level at runtime.
    2. Work with Global events. I have zero experience with this so I can't speak to how easy it is to work with. I have only ever heard negative things about it, as it has limitations and quirks you need to work around. But maybe someone else can give you advice on how to manage it.

  3. #3
    Quote Originally Posted by mobichan View Post
    It is not possible to automate this. You have 2 options I can think of to not spread duplicate code across many frames:

    1. You code your levels and engine in a single frame. This means the engine will load level data from some external source (array, text file, etc) and create the level at runtime.
    2. Work with Global events. I have zero experience with this so I can't speak to how easy it is to work with. I have only ever heard negative things about it, as it has limitations and quirks you need to work around. But maybe someone else can give you advice on how to manage it.
    3. Copy Paste the code in each frame. If you are going this way I would recommend a prototype Frame where you only code.

    With global events you cant sadly use qualifiers, there is a workaround that someone found somewhere on the forums (if u search).

  4. #4
    With global values, can't you make alt. Values for actives equal the global value and then use qualifiers on that?


    Sent from my iPhone using Tapatalk

  5. #5
    No Products Registered

    Join Date
    May 2015
    Posts
    20
    Quote Originally Posted by mobichan View Post
    It is not possible to automate this. You have 2 options I can think of to not spread duplicate code across many frames:

    1. You code your levels and engine in a single frame. This means the engine will load level data from some external source (array, text file, etc) and create the level at runtime.
    2. Work with Global events. I have zero experience with this so I can't speak to how easy it is to work with. I have only ever heard negative things about it, as it has limitations and quirks you need to work around. But maybe someone else can give you advice on how to manage it.
    give me more info about option 1, i dont fully understand what you mean

  6. #6
    The basic approach is that you load the level objects (type, position, parameters) from information stored somewhere (ideally an array). This can be done with a fastloops that goes item by item through an array, reading the values there and interpreting them with code you write.

    The trickiest part is that you need to make a level editor of some sort to create the data array. I would search the forums for data loading, level editors or single frame games. This topic has been discussed many times before. Also check out Nivram's site to see if there are any examples to get you started.

    Good luck!

  7. #7
    No Products Registered

    Join Date
    May 2015
    Posts
    20
    Quote Originally Posted by mobichan View Post
    The basic approach is that you load the level objects (type, position, parameters) from information stored somewhere (ideally an array). This can be done with a fastloops that goes item by item through an array, reading the values there and interpreting them with code you write.

    The trickiest part is that you need to make a level editor of some sort to create the data array. I would search the forums for data loading, level editors or single frame games. This topic has been discussed many times before. Also check out Nivram's site to see if there are any examples to get you started.

    Good luck!
    So, I would have to make a level editor that save's an array file, which then is loaded into a separate frame? isn't this pointless, since I would always need to copy the code over to that frame anyway? or are you suggesting that I just make all the levels in the same frame, and I would only have to edit the code of that one frame?

  8. #8
    You write your game code in one frame. The level editor can exist in that same frame or an entirely different one. It doesn't matter. The thing to remember is that you are only managing your game code in one place. You are loading in your level layouts through some loading code that you write in your game engine frame.

  9. #9
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    Melbourne
    Posts
    1,514
    So you'll end up with 3 frames. Each has its own unique code that will never need to be copy/pasted anywhere.

    1 Main Screen (this could be merged with #3 if you really want)
    2. Level Editor (you use this to create levels and save them as array files, but your player never sees this frame)
    3 The Game/Engine

    It'll probably take you a good few weeks to set it all up, building the level editor, recreating your levels, etc. And you'll definitely want to use a pre-existing example as to build from rather than try figuring it out yourself. But it's worth it. Copying/pasting code between frames is the worst. It's tedious, and you'll inevitably slip up and end up with slightly different code in different frames, which just creates more bugs and time-wasting.

    My Fusion Tools: VolCAMERA | Productiva | VACCiNE

  10. #10
    Clicker Fusion 2.5 Developer
    J3sseM's Avatar
    Join Date
    Feb 2013
    Location
    Finland
    Posts
    818
    If you've only 7 level frames, I'd just copy-paste the code over. I'm still doing that for 60+ frames or so. It's a pain in the ass, but in the end, it's quite quick to do.
    I rather have that pain than using global values or stuff that's more error prone.

    Depending on your game it might be a good idea to finalize the first game level, then try to break it. When it seems solid, only then work the other frames.

    EDIT: Too early for me... noticed I didn't answer your question, sorry mate!
    Last edited by J3sseM; 12th August 2017 at 07:00 AM.
    Currently working on DISTRAINT 2
    Released games: Silence of the Sleep and DISTRAINT

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Replies: 1
    Last Post: 5th February 2017, 07:03 AM
  2. Importing or layering frames
    By mrogers15 in forum Fusion 2.5
    Replies: 0
    Last Post: 14th December 2016, 06:38 AM
  3. Animation Automatically Centering Frames When Playing
    By thehunter006 in forum Fusion 2.5
    Replies: 4
    Last Post: 14th October 2015, 05:06 PM
  4. Importing new anim frames not reflected in-game
    By artician in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 31st May 2008, 06:52 AM
  5. importing multiple frames
    By westray in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 19th March 2008, 10:05 PM

Tags for this Thread

Posting Permissions

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