snapping to a grid

For questions about using Classic.

Post » Fri Oct 24, 2008 9:27 am

i have to take a break from my fun project and do some real work, and am using construct to build some basic prototypes to show a programmer some play mechanics.

I want an object to follow the mouse, the object is 30x30, but want the object to constantly snap to a 30x30 grid..

can anyone explain some math, or an efficient way to do this???

Thanks as always
B
4
S
2
G
5
Posts: 149
Reputation: 2,025

Post » Fri Oct 24, 2008 9:33 am

Set X and Y positions of this object not to MouseX and MouseY, but to:
Floor( MouseX / 30 ) * 30
Floor( MouseY / 30 ) * 30
B
6
S
3
G
6
Posts: 219
Reputation: 3,013

Post » Fri Oct 24, 2008 10:14 am

thankyou!!!
B
4
S
2
G
5
Posts: 149
Reputation: 2,025


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests