User Tag List

Results 1 to 7 of 7

Thread: Midpoint Scrolling

  1. #1
    No Products Registered

    Join Date
    Nov 2006
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Midpoint Scrolling

    How do you you use the midpoint formula to scroll in between (>amount here<) objects? I know that you use the midpoint formula to set the position of a "scroller" that scrolls the screen. What I don't know is how to loop through the actives (more than one type) and get the midpoint.

  2. #2
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    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)

    Join Date
    Jun 2006
    Location
    England
    Posts
    3,546
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    Re: Midpoint Scrolling

    To get an average you get the sum of the X's and Y's and divide them by the amount of objects.
    .:::.Joshtek.:::.

  3. #3
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Midpoint Scrolling

    That's a straight average, though, and would pull the screen further over in one direction if more objects were on one side. To get the midpoint, you'd need to find the minimum X/Y out of the group, the maximum X/Y, and set the position to halfway between them. That's just a general outline, because I don't really know the best way to actually do that...

  4. #4
    No Products Registered

    Join Date
    Nov 2006
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Midpoint Scrolling

    What I don't know is how to get the individual X's and Y's of each object.

  5. #5
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    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)

    Join Date
    Jun 2006
    Location
    England
    Posts
    3,546
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    Re: Midpoint Scrolling

    To get the midpoint
    1. Give all the objects you want to test the same qualifier (Group.Neutral)
    2. Create several counters: MinX, MinY, MaxX, MaxY, MidX, MidY
    3. Do the following code:
    [events]
    *Start of Frame
    -(Group.Neutral) : Spread value 0 in Alterable Value A
    *Always
    -(Counter Min : Set Counter to X( "(Group.Neutral)" )
    -(Counter Max : Set Counter to X( "(Group.Neutral)" )
    -(Counter MinY) : Set Counter to Y( "(Group.Neutral)" )
    -(Counter MaxY) : Set Counter to Y( "(Group.Neutral)" )
    -Start loop "midpoint" NObjects( "(Group.Neutral)" ) times
    -(Counter Mid : Set Counter to(value( "(Counter Min" )+value( "(Counter Max" ))/2
    -(Counter MidY) : Set Counter to(value( "(Counter MinY)" )+value( "(Counter MaxY)" ))/2
    *On loop "midpoint"
    +Alterable Value A of(Group.Neutral) = LoopIndex("midpoint")
    +X position of(Group.Neutral) < value( "(Counter Min" )
    -(Counter Min : Set Counter to X( "(Group.Neutral)" )
    *On loop "midpoint"
    +Alterable Value A of(Group.Neutral) = LoopIndex("midpoint")
    +X position of(Group.Neutral) > value( "(Counter Max" )
    -(Counter Max : Set Counter to X( "(Group.Neutral)" )
    *On loop "midpoint"
    +Alterable Value A of(Group.Neutral) = LoopIndex("midpoint")
    +Y position of(Group.Neutral) > value( "(Counter MaxY)" )
    -(Counter MaxY) : Set Counter to Y( "(Group.Neutral)" )
    *On loop "midpoint"
    +Alterable Value A of(Group.Neutral) = LoopIndex("midpoint")
    +Y position of(Group.Neutral) < value( "(Counter MinY)" )
    -(Counter MinY) : Set Counter to Y( "(Group.Neutral)" )
    [/events]
    .:::.Joshtek.:::.

  6. #6
    No Products Registered

    Join Date
    Aug 2006
    Location
    Westcountry, UK
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Midpoint Scrolling

    I'm not quite sure what you mean. If you mean an object (or vertex) that hangs between two objects then this example might help:

    http://raytrace.sitesled.com/Examples/example15.mfa

    The formula is just a simple one dimentional Ecludeien distance formula with an addition to find the percentage that the marker should be along the line of interpolation.

    For your question:

    ScrollX = X("1")+(X("1")-X("2"))/2
    ScrollY = Y("1")+(Y("1")-Y("2"))/2

  7. #7
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Paul_Boland's Avatar
    Join Date
    Jun 2006
    Location
    Waterford, Ireland.
    Posts
    2,739
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Midpoint Scrolling

    If you drop me an email at pkb@iol.ie I'll send you a copy of my Camera Control tutorial which shows how to create mid point scrolling with up to four objects on screen. It is 480Kb in size.
    KnightTrek Productions
    http://www.knighttrek.com

Similar Threads

  1. Best way to do scrolling like this?
    By Outcast in forum Multimedia Fusion 2 - Technical Support
    Replies: 19
    Last Post: 11th April 2012, 05:35 AM
  2. [Bug[ Scrolling
    By ProdigyX in forum Android Export Module Version 2.0
    Replies: 2
    Last Post: 17th December 2011, 03:53 PM
  3. Help with Camera Scrolling for Side-Scrolling
    By ThatOtherGuy in forum File Archive
    Replies: 4
    Last Post: 29th August 2009, 09:38 PM
  4. Scrolling Top Down
    By Doc4 in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 4th December 2007, 06:48 PM
  5. HW acc and scrolling
    By Blizna in forum Multimedia Fusion 2 - Technical Support
    Replies: 9
    Last Post: 13th November 2007, 08:13 AM

Posting Permissions

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