User Tag List

Results 1 to 4 of 4

Thread: What's the formula for moving diagonally?

  1. #1
    Clicker Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export Module
    Emerson3's Avatar
    Join Date
    Apr 2014
    Location
    Lafayette, Louisiana
    Posts
    721
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Question What's the formula for moving diagonally?

    Hey CLickteam,

    I'm using Fastloops to customize my characters movement. I know how to move vertically and horizontally, but how could I move diagonally?

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Hi Emerson,
    you'll just need to set your character X to X+(movement)*cos(angle) and Y to Y+(movement)*sin(angle)

    In 8 directional movements you'll only need 45° angles multiple
    (45=topright
    135=topleft
    225=bottomleft
    315=bottomright)
    but if you prefer you can move in any angled direction with above formula

    Depending on how you've setup your x-y position updates,
    you'll better base your movement on alterable values rather than actual screen X-Y positions,
    since they can hold float values (smoother precision), while X-Y screen positions are just integers

  3. #3
    Clicker Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export Module
    Emerson3's Avatar
    Join Date
    Apr 2014
    Location
    Lafayette, Louisiana
    Posts
    721
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hey Schrodinger,

    Thanks man. That seems pretty simple! Man, I need to brush up on some trigonometry.

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Yes, trigonometry rocks!

    This image just tells everything you need to know about it:

    Trigonometric_functions.jpg

    (by the way, not all those functions are covered by Fusion, but mostly yes)

Similar Threads

  1. Formula for moving an object along a path?
    By uprize in forum Multimedia Fusion 2 - Technical Support
    Replies: 12
    Last Post: 13th September 2009, 12:13 PM
  2. INI Formula Help
    By MajorityCA in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 8th February 2009, 01:28 AM
  3. Distance Formula
    By Dines in forum Articles
    Replies: 15
    Last Post: 29th May 2008, 11:33 AM
  4. Help with formula
    By LB in forum The Games Factory 2 - Technical Support
    Replies: 6
    Last Post: 13th June 2007, 02: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
  •