User Tag List

Results 1 to 4 of 4

Thread: Very new to this - need help with flags/variables

  1. #1
    No Products Registered

    Join Date
    Oct 2007
    Location
    UK
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Very new to this - need help with flags/variables

    I'm trying to make a very simple games for a 3 year old.
    There are 4 objects on the screen. The first time they are clicked I would like them to play a sound to move to the end of a path. Subsequent times reverse movement and play a different sound.

    I've tried using alterable variables and toggling flags but both events fire (one immediately after the other) on the first click.

    -start of frame set flag/variable to 0

    -leftclick on object
    -flag = 0
    --play sound - start movement - set flag =1

    -leftclick on object
    -flag = 1
    --play sound - reverse movement

    Please could someone tell me what I am doing wrong I have tried
    different orders of action etc - but still the both fire on the first click.


  2. #2
    Clicker Fusion 2.5 DeveloperFusion 2.5 DeveloperiOS Export ModuleMac Export ModuleSWF Export ModuleUnicode Add-on
    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)
    JasonDarby's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    4,938
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)

    Re: Very new to this - need help with flags/variables

    Hi Beannie

    Have you got an example file you can upload? Makes it slight easier to see what you are trying to do.

    I would use flags, and Groups. If you dont the main problem you might encounter is that the code runs from top to bottom and basically skips a step because the code becomes true straight away. (Not sure if that makes sense)

    So create your click events, then create two disabled groups, which will only become enabled when clicked on. Then in the group you will need to disable the group again.

    Jason

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5 DeveloperiOS Export ModuleMac Export ModuleSWF Export ModuleUnicode Add-on
    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)
    JasonDarby's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    4,938
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)

    Re: Very new to this - need help with flags/variables

    I thought it would be easier for me to make you an example file. You can access it in the file forum here:

    http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=59022#Post59022

    Ok alittle bit of explanation:

    1. Path Movement starts automatically unless you pause it within the path edit area. So the Start of frame i set the movement to Stop to prevent it moving.
    2.I then set up the code to check when the user has clicked on the object and the flag is 0. if so. play the sound, start the movement and then run the group which relates to each object.
    3.Below the user clicks is another set of events to check for the clicking of the object, this will check if the flag is set to on and then reverse the movement.
    4. Groups. The groups set the flag and then disables the groups to prevent them from always running.

    Important thing to remember. The code runs from top down, because this code is executed very quickly the order of your events is very important to it working correctly (this is also true to why you need groups).

    When you use the User clicks, it would run the code, but in your example the two events would have been run, because it would still think the user is clicking.

    So User Clicks:

    Flag = 0 .. so this is true....

    Then your setting the Flag to 1.

    Left click on object (because its very quick this is also still true)

    Flag = 1 (you set it, and its now true)

    Because of this your code would run straight through. In my example the group has stopped this problem from occuring.

    I hope that isnt too confusing.

    Jason

  4. #4
    No Products Registered

    Join Date
    Oct 2007
    Location
    UK
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Very new to this - need help with flags/variables

    Hi Jason,

    Yes I understand now.
    It all works perfectly

    Many thanks

Similar Threads

  1. Understanding variables/flags?
    By Thrawn in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 25th January 2011, 04:40 PM
  2. Groups, flags, variables: I´m stuck, please help
    By Leander in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 8th August 2008, 03:58 PM
  3. Help with flags
    By Dynamite in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 19th June 2008, 11:03 AM
  4. Flags
    By konjak in forum Multimedia Fusion 2 - Technical Support
    Replies: 55
    Last Post: 2nd July 2006, 02:53 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
  •