Please help me with this example.

Non-platform specific questions.

Please help me with this example.

Postby NevenResnik » Sat Jul 03, 2010 3:42 pm

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.
Attachments
SnapToGrid Help.zip
(173.74 KiB) Downloaded 63 times
NevenResnik
 
Posts: 42
Joined: Mon May 31, 2010 9:59 am
Score: 0 Give a positive score

Re: Please help me with this example.

Postby Hblade » Sat Jul 03, 2010 3:50 pm

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
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Please help me with this example.

Postby Camper1995 » Sat Jul 03, 2010 4:22 pm

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
Say hello to my little friend.
User avatar
Camper1995
 
Posts: 707
Joined: Tue Dec 30, 2008 7:20 pm
Location: Lost in the past.
Score: 44 Give a positive score

Re: Please help me with this example.

Postby Hblade » Sat Jul 03, 2010 4:44 pm

They have to be equal. For example: /16)*16
:D
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Please help me with this example.

Postby Camper1995 » Sun Jul 04, 2010 9:20 am

:shock: What a amateur I am.

Thanks :D
Say hello to my little friend.
User avatar
Camper1995
 
Posts: 707
Joined: Tue Dec 30, 2008 7:20 pm
Location: Lost in the past.
Score: 44 Give a positive score

Re: Please help me with this example.

Postby Game A Gogo » Mon Jul 05, 2010 7:03 pm

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
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron