User Tag List

Results 1 to 5 of 5

Thread: Versatile Isometric Grid Mouse Snapping

  1. #1
    Clicker Fusion 2.5 (Steam)
    Warguy555's Avatar
    Join Date
    Feb 2019
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Versatile Isometric Grid Mouse Snapping

    So, I have had a few issues trying to accomplish pixel isometric grid snapping. I seem to be screwing up some part of the calculation every time I try to do some semblance of grid snapping. I also tried asking the unofficial Reddit page how to do this and, rather frustratingly, my post was flagged as spam. Ideally, I'd like to have snapping that works for tiles of any dimension (or ratio). Currently, I am using tiles that follow a 2:1 ratio of width to height (32px wide and 16px high). Can someone explain how I can get these tiles to properly snap to the mouse coordinates? I'm really having trouble getting it to work and am not that great with certain math stuff. As an extra note, I want it to be a "staggered" isometric grid.

  2. #2
    Clicker Install Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)
    defisym's Avatar
    Join Date
    Jun 2017
    Location
    Asia
    Posts
    436
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    You can find the convert algorithm here:
    https://github.com/pvcraven/isometric_test
    And you can also use the getRealCoord/getGridCoord expression in this extension:
    https://community.clickteam.com/threads/109520-Beta-FindTheWay-All-New-A*-Path-Finding?highlight=findtheway
    Use setGridSize/setMap to init the extension then convert mouse coord to grid coord.

  3. #3
    Clicker Fusion 2.5 (Steam)
    Warguy555's Avatar
    Join Date
    Feb 2019
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't quite know how to translate the conversion into Clickteam Fusion stuff. That's probably one of the main sources of trouble here. I noticed that snapping to half the width and height of the tile gets close, but leaves situations where the snapping isn't fully correct. For example, a 32x16 tile is snapped to (XMouse/16*16, YMouse/8*8). That makes the tile end up in the correct position sometimes, but it can end up in between isometric tiles and isn't properly aligned to the grid. Is there a way I correct what I currently have so it could be used?

  4. #4
    Clicker Install Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)
    defisym's Avatar
    Join Date
    Jun 2017
    Location
    Asia
    Posts
    436
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Warguy555 View Post
    I don't quite know how to translate the conversion into Clickteam Fusion stuff. That's probably one of the main sources of trouble here. I noticed that snapping to half the width and height of the tile gets close, but leaves situations where the snapping isn't fully correct. For example, a 32x16 tile is snapped to (XMouse/16*16, YMouse/8*8). That makes the tile end up in the correct position sometimes, but it can end up in between isometric tiles and isn't properly aligned to the grid. Is there a way I correct what I currently have so it could be used?
    isometric coordinate conversion also involves the width/height of the map.
    If you are tired of math you can just use the extension, it supports Windows & Android for now and I'm working on the H5 port.

  5. #5
    Clicker Fusion 2.5 (Steam)
    Warguy555's Avatar
    Join Date
    Feb 2019
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright, thanks for the help. I actually just tried an experiment and it worked out marvelously. It doesn't use anything too complicated, it uses the grid snapping I mentioned earlier. All I did was add detection for how close the mouse cursor was to what would be considered a "corner" in the nonexistent box that snaps to the mouse and shift the current tile coordinates by values that I know are correct. For instance, if you are closer to the top right corner of the box, it shifts right by half the width and down by half the height.

Similar Threads

  1. ISOMETRIC JUMP -Isometric grid - Tutorial
    By Sparckman in forum Guides, Tutorials, Examples, Widgets
    Replies: 0
    Last Post: 6th August 2016, 02:19 AM
  2. Snapping To Grid Quick Backdrops
    By TheIronWarrior in forum The Games Factory 2 - Technical Support
    Replies: 2
    Last Post: 25th March 2015, 08:32 PM
  3. Isometric grid bug
    By fishrod in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 13th January 2014, 03:46 PM
  4. Snapping to a grid in runtime
    By Boba Fonts in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 17th April 2012, 01:18 AM
  5. Grid snapping
    By Sean_M in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 2nd April 2010, 12:37 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
  •