Jump to content


Photo

simple grid snap problem


  • Please log in to reply
4 replies to this topic

#1 joshuaallen64

joshuaallen64

    GMC Member

  • GMC Member
  • 677 posts
  • Version:GM:Studio

Posted 21 May 2012 - 11:25 PM

I need a little help with my grid.

Like normal I use:
x = (mouse_x div 32) * 32
y = (mouse_y div 32) * 32

to snap the object to the grid but the problem is that my grid moves.

Here is an example of my problem link.
  • 0

#2 ParrotPeach

ParrotPeach

    GMC Member

  • New Member
  • 82 posts
  • Version:GM:Studio

Posted 22 May 2012 - 12:35 AM

I didn't have an issue with it... however

Maybe make two objects. 'object black box' and 'object draw grid'... I hope that helps. :thumbsup:

Edited by ParrotPeach, 22 May 2012 - 12:36 AM.

  • 0

#3 joshuaallen64

joshuaallen64

    GMC Member

  • GMC Member
  • 677 posts
  • Version:GM:Studio

Posted 22 May 2012 - 12:42 AM

I didn't have an issue with it... however

Maybe make two objects. 'object black box' and 'object draw grid'... I hope that helps. :thumbsup:


I'm sorry I should have told you that you need to use wasd to move the grid.

Edited by joshuaallen64, 22 May 2012 - 12:42 AM.

  • 0

#4 Kindred

Kindred

    Pixel Artist

  • New Member
  • 1197 posts
  • Version:None

Posted 22 May 2012 - 12:42 AM

This will do the trick:
xDiffMod = xDiff mod 32
yDiffMod = yDiff mod 32
x = ( (mouse_x - xDiffMod) div 32 ) * 32 + xDiffMod
y = ( (mouse_y - yDiffMod) div 32 ) * 32 + yDiffMod

  • 0

#5 joshuaallen64

joshuaallen64

    GMC Member

  • GMC Member
  • 677 posts
  • Version:GM:Studio

Posted 22 May 2012 - 12:44 AM

This will do the trick:

xDiffMod = xDiff mod 32
yDiffMod = yDiff mod 32
x = ( (mouse_x - xDiffMod) div 32 ) * 32 + xDiffMod
y = ( (mouse_y - yDiffMod) div 32 ) * 32 + yDiffMod


thanks, that's just what I needed.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users