Page 1 of 1

Please help me with this example.

PostPosted: Sat Jul 03, 2010 3:42 pm
by NevenResnik
Hey. This is an example of how I want my "Snap To Grid" to work. The Circle must snap to the Square when the mouse hovers above it. I don't know how to make that work Can you please help me?

Would be much appreciated.

Re: Please help me with this example.

PostPosted: Sat Jul 03, 2010 3:50 pm
by Hblade
On the circle actor, put this code in create actor
Code: Select all
FollowMouse("Event Actor", BOTH_AXIS);


Now, in draw_actor, put this code in:
Code: Select all
x=round(x/32)*32;
y=round(y/32)*32;


There ya go :D

Re: Please help me with this example.

PostPosted: Sat Jul 03, 2010 4:22 pm
by Camper1995
How its working that: blah blah blah ... x/32)* 32;

I dont understand it. When I change the numbers, its not snapping so good. :-5

Re: Please help me with this example.

PostPosted: Sat Jul 03, 2010 4:44 pm
by Hblade
They have to be equal. For example: /16)*16
:D

Re: Please help me with this example.

PostPosted: Sun Jul 04, 2010 9:20 am
by Camper1995
:shock: What a amateur I am.

Thanks :D

Re: Please help me with this example.

PostPosted: Mon Jul 05, 2010 7:03 pm
by Game A Gogo
Here's what you asked me to do :)
SnapToGrid-Test.ged
(1.47 KiB) Downloaded 64 times

I uploaded only the GED since I used nothing more than what was already in the original data file