actor floats between two

Non-platform specific questions.

actor floats between two

Postby j2graves » Sat Sep 10, 2011 1:17 pm

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...
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score

Re: actor floats between two

Postby NERDnotGEEK » Sat Sep 10, 2011 2:40 pm

This is basically just GCSE coordinate geometry. Ill make you a quick demo :)
NERDnotGEEK
 
Posts: 75
Joined: Sat Oct 30, 2010 1:48 am
Score: 12 Give a positive score

Re: actor floats between two

Postby NERDnotGEEK » Sat Sep 10, 2011 2:55 pm

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 :)
Attachments
chain.zip
(4.35 KiB) Downloaded 82 times
NERDnotGEEK
 
Posts: 75
Joined: Sat Oct 30, 2010 1:48 am
Score: 12 Give a positive score

Re: actor floats between two

Postby ikarus » Sun Sep 11, 2011 5:08 am

I think I may take a look at that as well
>>>>>>>>>>>>>>>>>>>>> http://www.code1011.com <<<<<<<<<<<<<<<<<<<<<<<
ikarus
 
Posts: 143
Joined: Fri Aug 12, 2011 3:06 am
Score: 11 Give a positive score

Re: actor floats between two

Postby NERDnotGEEK » Sun Sep 11, 2011 3:31 pm

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 :)
NERDnotGEEK
 
Posts: 75
Joined: Sat Oct 30, 2010 1:48 am
Score: 12 Give a positive score

Re: actor floats between two

Postby j2graves » Sun Sep 11, 2011 5:42 pm

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.)
Attachments
chainings2.ged
(2.78 KiB) Downloaded 72 times
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score

Re: actor floats between two

Postby NERDnotGEEK » Sun Sep 11, 2011 8:41 pm

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 :) )
NERDnotGEEK
 
Posts: 75
Joined: Sat Oct 30, 2010 1:48 am
Score: 12 Give a positive score

Re: actor floats between two

Postby NERDnotGEEK » Mon Sep 12, 2011 4:53 pm

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
NERDnotGEEK
 
Posts: 75
Joined: Sat Oct 30, 2010 1:48 am
Score: 12 Give a positive score

Re: actor floats between two

Postby j2graves » Tue Sep 13, 2011 1:37 pm

Thank you! :D
+1
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score

Re: actor floats between two

Postby NERDnotGEEK » Tue Sep 13, 2011 9:47 pm

Any time :) <3
NERDnotGEEK
 
Posts: 75
Joined: Sat Oct 30, 2010 1:48 am
Score: 12 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest