User Tag List

Results 1 to 6 of 6

Thread: Movement calculation

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export Module
    Chrille's Avatar
    Join Date
    Jul 2006
    Posts
    389
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Movement calculation

    I would like to make a system for moving things using position actions. I know how I want it to work but I can't calculate how to do it on my own.

    The way I want it to work sounds quite simple. I need the character to be able to move towards a set of coordinates in a straight line, meaning I'd have to calculate how far ,in x and y, the character would have to move in relevance to the final coordinates and also depending on the character's speed.

    For example, target is at coordinates 40x40 and the character is at 80x80. For every step towards these coordinates he'd move x-4 y-4, if his speed was 4. However, like I've said I have no idea how to put that into an expression.

    Btw, is there an object that can calculate the distance between two objects like that old RTS object could?

  2. #2
    Clicker Multimedia Fusion 2
    Skeets's Avatar
    Join Date
    Apr 2007
    Location
    Utah, USA
    Posts
    360
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Movement calculation

    holy cow don't make an easy thing complicated! put another active object at the target, tell your object you want to move there to always -> look at (active)then... object overlaps active -> stop.

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCSWF Export Module
    Alonso's Avatar
    Join Date
    Jul 2006
    Posts
    681
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Movement calculation

    That would work, but it's not reall a straight line (since the object only moves in 32 directions)--unless you don't mind this?

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    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)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,366
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)

    Re: Movement calculation

    Clickteam's Movement Controller can calculate the distance for you. Check your extensions list, you should find it there.

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export Module
    Chrille's Avatar
    Join Date
    Jul 2006
    Posts
    389
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Movement calculation

    Popcorn: Thanks for the suggestion!

    As for using another object to guide the character in a straight path, that's what I'm already using, but it's not very efficient. A calculation would save on the game performance by using less objects and I would also have other uses for the calculation.

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export Module
    Chrille's Avatar
    Join Date
    Jul 2006
    Posts
    389
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Movement calculation

    This algorithm was suggested to me by a programmer friend:
    http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm

    This would work perfectly for checking a line between two points for obstacles. I'd use the optimisation bit I presume. Problem is, MMF doesn't use boolean (extension, perhaps?) and there are no swap functions. How would this look in MMF2's event editor? Any experts?

Similar Threads

  1. Help with angle calculation!
    By J3sseM in forum Multimedia Fusion 2 - Technical Support
    Replies: 14
    Last Post: 29th August 2013, 12:15 PM
  2. calculation help
    By aylictal in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 21st May 2013, 02:45 PM
  3. Angle calculation bug?
    By Fanotherpg in forum SWF/Flash Export Module Version 2.0
    Replies: 2
    Last Post: 23rd April 2012, 09:38 AM
  4. Speed calculation
    By Boba Fonts in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 9th May 2010, 05:29 PM
  5. Dodgy Calculation
    By Chrille in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 11th January 2008, 12:17 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
  •