movePolygonal

Create fast, sprite powered games with Animation Engine, co-developed with DerBrill Software!

Moderators: heatherlaine, kevinmiller, robinmiller, malte

Post Reply
SparkOut
Posts: 2857
Joined: Sun Sep 23, 2007 4:58 pm

movePolygonal

Post by SparkOut » Wed Apr 27, 2011 7:03 pm

I'm wondering what the best technique is for having a set of images all follow a polygonal path (the same path for all), at an even spacing between them. movePolygonal is obvious for the first image, but to have the subsequent images in a nice "chain" or "follow-the-leader" is it best to create their own set of points with different first / last points or to do some timing and then adjust the sending of the movePolygonal message.
Hoping I'm just being dense and Malte will say "you can do that in 1 line by..." :lol: (AE does spoil us a lot)

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4028
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: movePolygonal

Post by bn » Wed Apr 27, 2011 8:20 pm

Hi SparkOut,

nice to see you again.

I attach a little stack that attempts this. It probably could be adjusted to your use.

Kind regards

Bernd
Attachments
movingParadeImages.livecode.zip
(1.58 KiB) Downloaded 388 times

SparkOut
Posts: 2857
Joined: Sun Sep 23, 2007 4:58 pm

Re: movePolygonal

Post by SparkOut » Thu Apr 28, 2011 9:33 am

That's great Bernd, vielen Dank!
It's nice to be back.
I sort of depend on AE for other elements that are going on though, so I'm now wondering how I can adapt this approach to using AE, or... maybe rethinking the whole idea and using your (perfect) technique for more of it.
Thanks again

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Re: movePolygonal

Post by malte » Thu Apr 28, 2011 2:44 pm

Hi sparkOut, sorry for the late reply. I am currently out of office, so just checking here sporadically.

Savest bet

on init
repeat with i=1 to the number of images -- adjust to your needs
set the movePolyGonal["step"] of img i to i*10
send "movePolygonal" to img i
set the movePolyGonal["step"] of img i to 1
end repeat
end init

do stuff as you did before.

Hth,

Malte

SparkOut
Posts: 2857
Joined: Sun Sep 23, 2007 4:58 pm

Re: movePolygonal

Post by SparkOut » Tue May 03, 2011 3:31 pm

Hi Malte! danke sehr!
Sorry for late response too (been enjoying the holiday weekend in the sun without really looking much at a computer for a change).
I think I may end up having to reconsider what I'm doing overall anyway, but thanks for the input. What I thought I might be able to find is some sort of method of a "movePolygonal" in relation to a "master" sprite, while still being constrained to the points of the same polygonal path.

To give more info:

I am creating a model railway layout, with various track loops and junctions with points (railway points). What I am looking for is to have a train engine follow the path, while towing a set of carriages, which obviously need to follow the same path at a fixed distance from the engine or other carriage. I also need to be able to reverse the engine direction.

So far I have got the engine working perfectly, so it waits at a signal if the points are set against it, and continues on the new track segment when the points are switched in its favour. Reversing is fine too. I'm struggling with the way to deal with the movement of the carriages in one direction or the other, being constrained to the points of the track line, and remaining attached to the other segments of the train. Are there any nifty things in AE that can help here? Or any other clues to get my brain kickstarted?

SparkOut
Posts: 2857
Joined: Sun Sep 23, 2007 4:58 pm

Re: movePolygonal

Post by SparkOut » Thu May 05, 2011 8:55 am

I tackled this in the end by simply making an offset of the right distance on the coordinates of the first point on the path before setting the movePolygonal["pointsList"] for each "carriage".

Post Reply

Return to “Animation Engine”