User Tag List

Results 1 to 6 of 6

Thread: Looking in only specific Angles

  1. #1
    Clicker Multimedia Fusion 2Android Export Module
    Corlen's Avatar
    Join Date
    Mar 2007
    Location
    Your House
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Looking in only specific Angles

    Is there any easy mathematics I can use in a "set direction" command after a "look in direction of" command that will make an object look in the direction of another object but only in... let's say four directions since my game I'm working on currently has four directional movement.

  2. #2
    No Products Registered

    Join Date
    Dec 2006
    Posts
    319
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Looking in only specific Angles

    If I understand correctly, the only thing that comes to mind is making four events on each of which you will be comparing position of object 1 to position of object 2 and then setting direction accordingly, like this:

    xpos1 > xpos2: set direction to 16
    xpos1 < xpos2: set direction to 0
    ypos1 > xpos2: set direction to 8
    ypos1 < xpos2: set direction to 24

    There might be other ways to do this but they might not necessarily be faster.

  3. #3
    Clicker Multimedia Fusion 2Android Export Module
    Corlen's Avatar
    Join Date
    Mar 2007
    Location
    Your House
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Looking in only specific Angles

    I already know that method, I was wondering if there was a mathematic formula that could round a number to multiples of 8.

  4. #4
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export Module
    Pineapple's Avatar
    Join Date
    Oct 2010
    Posts
    431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Looking in only specific Angles

    Try: (value)/8x8

    I use this all the time to force actives to align to a grid. Should work for your purposes too.

  5. #5
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,393
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)

    Re: Looking in only specific Angles

    Nearly, but that actually won't work, because MMF2 will always round-down (instead of rounding down/up to the nearest whole number).

    The proper solution is:

    Round(Dir( "Active" )/8.0)*8

    Note: In addition to using "Round()", you also MUST include the ".0"

  6. #6
    Clicker Multimedia Fusion 2Android Export Module
    Corlen's Avatar
    Join Date
    Mar 2007
    Location
    Your House
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Looking in only specific Angles

    Thanks, it works like a charm and was easy to implement on top of that.

Similar Threads

  1. Replies: 4
    Last Post: 2nd July 2012, 08:05 PM
  2. How do i set the # of angles to 360?
    By GaryFreeman in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 1st September 2011, 01:13 AM
  3. Angles Example for EE
    By Eliyahu in forum File Archive
    Replies: 0
    Last Post: 24th April 2011, 01:34 AM
  4. specific animation has played a specific frame?
    By mobichan in forum Multimedia Fusion 2 - Technical Support
    Replies: 15
    Last Post: 22nd April 2008, 04:34 PM
  5. angles
    By Horn in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 4th November 2006, 04: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
  •