Hi, In this Tutorial we are going to learn how to make the Magnet Effect, First you need three object:
1) Sprite: Magnet.
2) Sprite: Screws.
3) Button: reset
First you must have two sprites: Magnet and screws, You'll need to make your own graphics.
Second you must create a button named reset for resitting layout.
After you got the sprites you must add the dragndrop behavior to the Magnet, and three behaviors for the screws: custom movement, Line of sight, and Pin behavior. Also you must add instance variables for screws called On and make it Zero., and make the line of sight range 150.
Now, For the Events, Lets Start To the Graphic Effects, add (EveyTick) event, and add condition for screws : Set angle Towards position (Magnet.X & Magnet.Y).
Second Event: For Screws, when they have Line Of Sight to Magnet, and if there instance variable (On) is Zero. Add Condition: Custom Movement Accelerate 5000 px/sc toward (Magnet.X & Magnet.Y)
Third Event: Add Event when the screw collide with Magnet. Add Condition: Set Instance Variable On to 1; Stop Custom Movement; Pin Screw to Magnet By Position and Angle.
Fourth Event: Add event when Reset button is clicked, Add Condition: Reset Layout.
If you want to test it or See its demo, The .capx file is attached.