Move an image along multiple motion paths in any order when you click any images

Mar 31, 2021

Hello - on the image below, I want the user to be able to click on any image (numbered 1 through 10), then have the car move along the orange line and stop at the clicked image; and the user can click on any image again in any order again, and move the car to the clicked image/number. Is this possible? Thank you so much for any insight.


2 Replies
Walt Hamilton

You can if you want to expend that much effort.

Start by placing all the targets equal distances apart (or your workload will be 10 times more). Create six motion paths with relative starts:

one (#1) to move between images from left to right, one (#2) to move from 3 to 4, one (#3) to move from 4 to 3, one (#4) to move from right to left, one (#5) to move from 7 to 8, and one(#6) to move from 8 to 7.

Create a layer for each of the ten images.  The layer will hold triggers, and keep you from having to write a zillion conditions on the triggers.

You need a variable to keep track of where the car is. When you click a destination, show the layer for that destination.

Example using the motion paths as I numbered them. Wherever the car is, you want to move it to 10.  10 is clicked. Layer 10 is shown.  Triggers are;'

Move car on motion path 1 if car is on 1 when timeline starts on this layer. (For all triggers, the When is when timeline starts on this layer.) Set car to 2 if car is on 1. move car on path 1 if car is on 2. Set car to 3 if car is 2. Move car on path 2 if car is  on 3. Set car to 4 if car is 3. Move car on path 4 if car is on 4. Set car to 5 if car is on 4. Move car on path 4 if car is on 5. Set car to 6 if car is on 5. Move car on path 4 if car is on 6. Set car to 7 if car is on 6. Move car on path 5 if car is on 7. Set car to 8 if car is on 7. Move car on path 1 if car is on 8. Set car to 9. Move car on path 1 if car is on 9. Set car to 10 if car is 9. Hide this layer if car is 10 when timeline starts on this layer.

If you keep the triggers in this order, when you show the layer, it will run through the triggers until it finds the car, and will move it. You cannot take a shortcut and leave out the conditions, because every trigger is examined without regard to any other trigger, and if it doesn't have a condition, will be executed.

For the ones between 1 and 10, you will have to track from one to the destination, and from 10 to the destination. Be sure to start at 1 and work up to the destination, and start at 10 and work down. Ten layers with maybe 20 or so triggers each, and you're in like Flynn.

The most important thing is to be very careful setting the spacing, so one motion path will move between every set of images.