Now I haven't actually played that game, but imagine you click one spot and drag along and it creates track right?
First off when you create a new object for your track pieces, I suggest adding 1 animation for each piece of track you will have. So animation 1 is straight track, animation 2 is right corner, and so on. Now, on any frame of any animation, select the image point button on the left of the image window (looks like a little target).
When you click on that, a little window will pop up showing you the list of image points, the first one being called 'origin'. Now, add 4 more image points, and right click on them. Then choose 'quick assign' and make one left, one right, one top and one bottom, then name them appropriately. Once you have done them all, again right click each one and select 'apply to all animations'. And now you have image points on every side of every piece of track!
Now you do: 'is mouse pressed' + is overlapping track (inverted): create track (there are many ways to make the new track snap to grid, but I don't have time to go into it. If unsure, just look around the tutorials - there's a lot of info for it!).
Now create some small square images called 'detector left/right/etc.'. Give them the variable 'track UID'.
Then have an event: 'On track created': track spawn object 'detector left on image point 'left', 'detector right' on image point 'right', and so on. Then on detector created: 'set 'track UID' to 'track(track.count-1).uid''. This will make sure that they only affect the latest piece of track.
Now you can do something like:
'For each track: if detector left is overlapping track + detector left track UID = track.uid, detector up is overlapping track + detector up track UID = track.uid: set track animation to 'turn up''
This isn't 100%, you will need to decide many things like when to destroy the detectors, whether the track can split in 3 ways, etc., etc., but this is the general method I would start with.
Sorry I don't have more time to help, it does sound like a fun project to work on :)