Page 1 of 1

actor floats between two

PostPosted: Sat Sep 10, 2011 1:17 pm
by j2graves
I've been asking for a lotta help lately, haven't I? Well now I need help making multiple actors float between two actors. I'm trying to make one actor chained to another, and I want the chain to be somewhat stretchable. so I want one actor to always remain 1/2 the distance between them, one 1/4 the distance, one 3/4 the distance, and ones that are always about 1/2 the distance between the chain links. Hope someone can help me out here...

Re: actor floats between two

PostPosted: Sat Sep 10, 2011 2:40 pm
by NERDnotGEEK
This is basically just GCSE coordinate geometry. Ill make you a quick demo :)

Re: actor floats between two

PostPosted: Sat Sep 10, 2011 2:55 pm
by NERDnotGEEK
here ya go :) i commented it all for you so you can see how it works then implement it into your game or change stuff

EDIT

Just thinking as well, you could do this with clones. having the MidPointChainParts and ChainParts being the only two actors your need, then MidPointChainParts would find the midpoint of the ChainParts clone + and - 1 of its clone number. and the ChainParts finding the midpoint of A and ChainParts clone number + 1 of its. ect ect. that way you could have it create as many chain parts as it needs if the distance between the chain parts is too great leaving no gaps. a little more complicated. and I'm useless with clones so I wont make a demo of that just yet :) just letting you know that it is possible to do that and no way to hard to implement once you understand how I did it in this demo :) real rushed explanation sorry if you cant understand it, its only an extra note anyway :)

Re: actor floats between two

PostPosted: Sun Sep 11, 2011 5:08 am
by ikarus
I think I may take a look at that as well

Re: actor floats between two

PostPosted: Sun Sep 11, 2011 3:31 pm
by NERDnotGEEK
coordinate geometry is a very good thing to brush up on, its a very useful part of maths when making games, allows you to do all sorts of things. That and the Decision module from A level maths. Gives you a lot of power over graphs. and since game editor is basically a large graph, a lot of power when it comes to making your games :)

Re: actor floats between two

PostPosted: Sun Sep 11, 2011 5:42 pm
by j2graves
Thanks for the help, but I'm afraid that it doesn't work in the context that I'm trying to use it in. In a demo I was given earlier, I was shown how to make an actor circle around another. I want the chains to be between the circling actor and the center actor. Problem is, it seems the circle around coding messes up this code... Just take a look at this. (It doesn't include the data, but it uses the same sprites as was in your demo so I don't need to include it.)

Re: actor floats between two

PostPosted: Sun Sep 11, 2011 8:41 pm
by NERDnotGEEK
I had a look at this and kinda figured your trying to make some sort of swing on a rope kinda thing? your going to have to use another circle round code to do that im afraid, the one you was given works, but it also uses parenting, that will mess up any code that does this part for the as the x and y values go a bit funny when your use parenting and as far as I can think, you need the x and y values to do this part of what you need. this is a little harder maths, you need a circle round code that you can change the Radius and the Centre point. Ill post one tomorrow after school for you, if I can get it working(already got it to work for the bottom have of the circle, its harder to get the top half working as well :) )

Re: actor floats between two

PostPosted: Mon Sep 12, 2011 4:53 pm
by NERDnotGEEK
Okay I must have just been having a complete idiot moment last night. instead of using parent, just add the X and Y values of the actor you want your thing to rotate round. this will make it go round a circle with the centre point of the added x and y values. I should have remembered this last night, but I was sleepy :) here's an example, working perfectly with my chain as well :)
chainings2.ged
(2.8 KiB) Downloaded 91 times

Re: actor floats between two

PostPosted: Tue Sep 13, 2011 1:37 pm
by j2graves
Thank you! :D
+1

Re: actor floats between two

PostPosted: Tue Sep 13, 2011 9:47 pm
by NERDnotGEEK
Any time :) <3