User Tag List

Results 1 to 6 of 6

Thread: Setting angle for a vector movement

  1. #1
    No Products Registered

    Join Date
    Dec 2006
    Posts
    1,332
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Setting angle for a vector movement

    I am creating a game in which comets rain down on a city and you have to shoot the comets out of the sky. I only have one direction for the comet and I am changing the angle based on the vector direction of the comet. I am using the equation

    "DirToAngle( "Clickteam Movement Controller", VEC_Dir( "Clickteam Movement Controller", Fixed( "Comet3" )))"

    The angles this creates are very random. Even two comets moving in the same direction can have completely different angles.

  2. #2
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleSWF Export Module

    Join Date
    Jun 2006
    Location
    Merseyside, UK
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Setting angle for a vector movement

    Probably need to see an example to ready help but ensure you set velocity / speed before using angles. If moving at close to zero getting angles can have odd effects.

  3. #3
    No Products Registered

    Join Date
    Dec 2006
    Posts
    1,332
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Setting angle for a vector movement

    Yes, the comets are moving at a very slow pace. Here is a stripped down version of the game.

    Example

  4. #4
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleSWF Export Module

    Join Date
    Jun 2006
    Location
    Merseyside, UK
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Setting angle for a vector movement

    Replace your set angle with:

    VEC_Dir( "Clickteam Movement Controller", Fixed( "Comet3" ))+90

    The DirToAngle is used to convert an angle in degrees to the closest 32 dir in MMF, so in this case you don't want that, you want the angle in degrees anyway.

    As the MMF image rotation has 0 as directly up rather than the positive x-axis you need to add 90 degrees to correct for the difference in implementation.

  5. #5
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleSWF Export Module

    Join Date
    Jun 2006
    Location
    Merseyside, UK
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Setting angle for a vector movement

    PS I recommend you use:

    VEC_Dir( "Clickteam Movement Controller", 0 )+ 90

    Using 0 rather than the objects fixed value tells the extension to use the last set object, it makes using the same code over again easier as you can copy and paste without worrying about the name of the objects.

  6. #6
    No Products Registered

    Join Date
    Dec 2006
    Posts
    1,332
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Setting angle for a vector movement

    Thank you, that works fine.

Similar Threads

  1. Vector angle math
    By tompa in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 2nd December 2013, 07:31 AM
  2. Help with Angle Setting for Compass
    By Jaklar in forum iOS Export Module Version 2.0
    Replies: 1
    Last Post: 24th March 2013, 10:52 PM
  3. Vector bullet fired from 360...how to set angle to face direction?
    By Blacstar in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 8th March 2012, 05:01 PM
  4. Vector Movement - How to detect angle of wall?
    By Strife in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 30th September 2010, 12:15 AM
  5. how to add to angle of vector movement
    By Deano in forum The Games Factory 2 - Technical Support
    Replies: 3
    Last Post: 31st January 2007, 02:23 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
  •