User Tag List

Results 1 to 9 of 9

Thread: Hexagonal Grid?

  1. #1
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Hexagonal Grid?

    Is there a formula for snapping objects to a hexagonal grid?

  2. #2
    Forum Moderator

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Location
    Bandon, Oregon
    Posts
    6,773
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)

    Re: Hexagonal Grid?

    Maybe this will help.

    These two events move the cursor horizontally following the mouse. This is the same code used to make a square grid cursor lock onto each tile.

    X position of 'Cursor' < XMouse - 16
    Set X position to X Cursor +32

    X position of Cursor > XMouse +16
    Set X position to X Cursor -32

    These four events move the cursor vertically by 24 pixels (this is the amount needed so that it is aligned vertically with the next row of tiles above and below it.

    Y position of Cursor < YMouse -12
    + XMouse > X Cursor
    Set Y position to Y Cursor +24
    Set X Position to X Cursor +16

    Y position of Cursor > YMouse +12
    + XMouse > X Cursor
    Set Y position to Y Cursor -24
    Set X Position to X Cursor +16

    Y position of Cursor < YMouse -12
    + XMouse < X Cursor
    Set Y position to Y Cursor +24
    Set X position to X Cursor -16

    Y position of Cursor > YMouse +12
    + XMouse < X Cursor
    Set Y position to Y Cursor -24
    Set X position to X Cursor -16
    ​458 TGF to CTF 2.5+ Examples and games
    http://www.castles-of-britain.com/mmf2examples.htm

  3. #3
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Hexagonal Grid?

    Thank you, it works.
    *throws Looki's one event solution into the recycle bin*

  4. #4
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Jun 2006
    Posts
    6,773
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Hexagonal Grid?

    These two events move the cursor horizontally following the mouse. This is the same code used to make a square grid cursor lock onto each tile.

    X position of 'Cursor' < XMouse - 16
    Set X position to X Cursor +32

    X position of Cursor > XMouse +16
    Set X position to X Cursor -32
    Or

    Always
    Set X position to XMouse Mod 32
    Set Y position to YMouse Mod 32

  5. #5
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export ModuleUnicode Add-on
    Looki's Avatar
    Join Date
    Aug 2006
    Location
    Karlsruhe, Germany
    Posts
    3,741
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)

    Re: Hexagonal Grid?

    Although it worked perfectly, fool -_-

  6. #6
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Hexagonal Grid?

    I prefer something I can understand and that others can understand becuase if I finish this I will be releasing it open source.

  7. #7
    Clicker Multimedia Fusion 2
    SEELE's Avatar
    Join Date
    Jul 2007
    Location
    Terra australis incognito
    Posts
    1,916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Hexagonal Grid?

    It's really quite! easy to understand.

  8. #8
    No Products Registered

    Join Date
    Dec 2008
    Location
    New England USA
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Hexagonal Grid?

    Hey guys,

    I've been trying to create a snapping grid (32x32 square) for a mouse-controlled Active Object.

    I've tried both versions of code that are listed in this thread with the same results: The Active Object always snaps back to a position near where it begins. No matter what direction or speed at which I move the mouse, it always returns to this "default" position as soon as it stops moving.
    I understand both versions of the code, and I know they should work perfectly, hence why I am unsure why it mine is not.
    Is there absolutely anything else I must do the the Frame, Active Object, or something else?

    I've also tried using an Easy Grid with and without these versions of code with identical results.

    Thanks in advance.

  9. #9
    No Products Registered

    Join Date
    Dec 2008
    Location
    New England USA
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Hexagonal Grid?

    Oops!

    I solved my problem:

    I had my object set with a movement type of "Mouse"

    THAT WAS BAD!

Similar Threads

  1. Grid of Counters
    By Bipolar_Games in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 17th March 2012, 05:18 PM
  2. Hex Grid Widget
    By Fimbul in forum Widgets
    Replies: 5
    Last Post: 18th June 2009, 10:05 PM
  3. Grid Movement
    By Joni in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 6th January 2007, 09:51 AM
  4. Grid Test App
    By droberson in forum File Archive
    Replies: 0
    Last Post: 3rd January 2007, 04:09 AM
  5. Grid Movement Example
    By DavidN in forum File Archive
    Replies: 1
    Last Post: 30th November 2006, 06:15 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
  •