User Tag List

Results 1 to 3 of 3

Thread: Fundamental coding question: loop, restrications..

  1. #1
    Clicker Fusion 2.5
    Fusion 2.5 (Steam)

    Join Date
    Sep 2007
    Location
    Austria
    Posts
    289
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Fundamental coding question: loop, restrications..

    Hi.

    The more code lines the event editor has the more work the computer has to do. Is this correct? I think more lines need more HD space or RAM. Anyway, it is important for coding that the events are well-structured and do what they are supposed to do, using the easiest, less complicated way.

    My question concerns some fundamental coding.
    An example:

    A game can be played alone or with two players. In the menu I have an event something like this: if mouse clicks on picture "one player" then set variable "#ofplayers?" to 1. If mouse clicks on picture "two players" then set variable "#ofplayers" to 2. Alright.

    In a level the events have to look at the actual number of players. If only one player is in the game then...if two players are in the game then...

    I use:

    if "#ofplayers" = 1 then...
    and
    if ... = 2 then...

    BUT...now my question. LOL
    How should such "game facts" (1 or 2 players?) be handled?

    Do I have to use
    "start of the game" and "#ofplayers" = 1 then...

    or just

    "if "#ofplayers" = 1 then...

    or

    "if "#ofplayers" = 1 AND only one action if event loops then..

    =====

    How does this work? Do I have to use "start of game" for such events? Does it loop and consume unneeded memory with just one line (if #ofplayers 1 then...)?
    Do I have to restrict such events?

    I am not sure what events should be restricted and what don't have to be.
    Of course a line "if number of points > 50 then play sound..." is wrong as this sound is repeated over and over when the player scores 51 points or more. So I have to restrict this event. But what about my example?

    Please help me and tell me what events should be restricted.

  2. #2
    Clicker Fusion 2.5
    Fusion 2.5 (Steam)

    Join Date
    Sep 2007
    Location
    Austria
    Posts
    289
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Fundamental coding question: loop, restrications..

    Thank you very much for your long and helpful comment.

  3. #3
    Forum Moderator Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module
    Sphax's Avatar
    Join Date
    Jun 2006
    Location
    Paris, France
    Posts
    4,454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Fundamental coding question: loop, restrications..

    "Start of frame" : executed before fadein and called once
    >> Fastest

    standard condition (like always) : executed after fadein at each loop of the frame
    >> Slowest

    conditions with "only one action when event loops" : executed after fadein only one time if the state of the condition has not changed since the previous frame
    >> Slower than "Start of frame"

Similar Threads

  1. A Slow Fast Loop... Or Bad Coding?
    By variant in forum File Archive
    Replies: 3
    Last Post: 9th February 2010, 12:46 AM
  2. Loop Question...
    By Orpa1 in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 25th July 2009, 05:35 AM
  3. Loop question
    By maVado in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 21st May 2009, 02:21 AM
  4. Fast loop question
    By Skeets in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 13th April 2008, 12:33 AM
  5. Yet another Loop question
    By Doc4 in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 24th November 2007, 03:01 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
  •