User Tag List

Results 1 to 2 of 2

Thread: Beta 5: [Example] Relative Sliding Movement

  1. #1
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleUnicode Add-on

    Join Date
    Jun 2006
    Location
    Australia
    Posts
    988
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Beta 5: [Example] Relative Sliding Movement

    Here's just an example I whipped up. I'm sure it will be useful to some of your games/applications.

    It would be useful for:
    • Controlling the player
    • Page sliding
    • "Throwing" an object

    It's only in one axis at the moment. I plan to expand it to two later, the code would be the same in the Y, unless you would prefer to use angles. It's also easy to add multiple touches at once.

    The code isn't really commented because I was just doing it for my own use. I can make it neater and explain it if people want me to. The variables are all stored in the "Movement" object. Most of them are temporary. The ones that should be changed are:

    XMoveSpeed: The speed/time it takes the object to move. Higher is slower. Best if it's a multiple of 2. Try 16 for slow. 1 for instant.

    XCoefficient: Ratio of pixel movement to finger movement. Value is divided by 100.0 at the start of frame to get a float/percentage. Set this to 200 for 2:1 pixel:finger movement. Play with it, you'll see what it does.

    Enjoy.
    Attached files Attached files

  2. #2
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleUnicode Add-on

    Join Date
    Jun 2006
    Location
    Australia
    Posts
    988
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Beta 5: [Example] Relative Sliding Movement

    Forgot to comment the variables in that version.

    Variables:
    StartX: The start position of the object when the touch starts

    StartTX: The start position of the touch

    XAmount: The difference from the start touch x and the current touch x

    Moving: A flag 0/1 to test if the movement (workaround for the 'quirk' I mentioned on the other thread)

    XMoveSpeed: The speed/time it takes the object to move. Higher is slower. Best if it's a multiple of 2. Try 16 for slow. 1 for instant.

    XCoefficient: Ratio of pixel movement to finger movement. Value is divided by 100.0 at the start of frame to get a float/percentage. Set this to 200 for 2:1 pixel:finger movement. Play with it, you'll see what it does.

    TempX: Where the player would like to move to.

    SmoothX: The calculated smoothed out movement using the variables above.

Similar Threads

  1. How to change path movement relative to another object's location?
    By LeanGamer in forum The Games Factory 2 - Technical Support
    Replies: 1
    Last Post: 5th June 2013, 08:17 AM
  2. And I said, "What about relative point movement:?"
    By Mdsx in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 8th April 2010, 07:54 PM
  3. Relative sub-pixel movement
    By Nifflas in forum Widgets
    Replies: 6
    Last Post: 2nd February 2010, 12:32 PM
  4. Replies: 1
    Last Post: 30th December 2009, 01:56 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
  •