Page 1 of 1

Is there a way to link actors other than parenting?

PostPosted: Tue Nov 29, 2005 5:11 pm
by ericdg
I am trying to link to actors together and use physical response for both of them. For example when you drop a ball using physical response it bounces down the hill if you have simulated gravity.

But if you drop a image of a stick with a ball on each end, the entire image bounces just like one ball.

I would like to put a ball on the end of a stick and another ball on the other end and have each ball have it's own physical response so that the stick would spin around depending on what the balls collided with.

I tried with parenting, but actors cannot parent their own descendants.

Is this possible? Thanks.

PostPosted: Tue Nov 29, 2005 9:33 pm
by willg101
You could use the code
Code: Select all
x=LinkedActor.x
y=LinkedActor.y
on draw actor.

PostPosted: Wed Nov 30, 2005 8:44 am
by ingsan
Or if you want your LinkedActor to be at a different position than the parentActor, you can increment its coordinates. Ex :
Code: Select all
x=LinkedActor.x + 10 // or negative
y=LinkedActor.y + 10 // or negative

PostPosted: Thu Dec 01, 2005 3:38 am
by ericdg
Thanks for the help. :lol:

I still can't get it to do what I want.

Basically I want to use 3 actors to make a car. One for the body and the other two for the tires. I want them to be linked so they all stay together and I want the car to be able to roll down a hill and use the tires as seperate collisions. This way the car can lean forward and back and even flip over if the right collision exists.

It's not looking like this is possible, or at least in my realm of programming.

Thanks guys.

PostPosted: Thu Dec 01, 2005 9:58 pm
by willg101
It's going to be quite hard to make the wheels flip with the car if they are seperate actors. :?

PostPosted: Fri Dec 02, 2005 12:28 am
by makslane
You can try something like this:

- Create the two tires
- Create the car
- On car Draw Actor event, make y = tire1.y - 50; //for example
- Make x = (tire1.x + tire2.x) / 2;
- Make the tires collide with the hill

Now, the problem is make the tires separated . I think you can make a third tire actor, but make it invisible. The actor must collide with physical response with the real tires.

I don't know if will works... Any ideas?

PostPosted: Fri Dec 02, 2005 2:11 pm
by ericdg
Thanks for the tips, I'll try some of those suggestions.

Willg101, you mentioned it would be hard to flip the car with the tires if they are seperate actors, what if they were one actor. Can you make an actor flip or rotate an image based on physical response, so it would simulate a 2d car with a side view flipping over, or popping a wheelie, etc.

Makslane, i just purchased GE and am having fun experimenting with it. Also I like that you support your product so well by responding to the forums and updating your product. Do you have any input on the above question to willg101?

Thanks.

PostPosted: Fri Dec 02, 2005 3:55 pm
by Novice
Hi ericdg, i was having the same problem some time ago and i have to tell you that it aint easy. GE dosent suport rotation so you have to make everything from animations.

You should make the two tire actors and in draw actor do this
Code: Select all
tire1.x=car.x+20;
for the first, for the second
Code: Select all
tire2.x=car.x-20;

they should both have gravity and collision with the ground
for the height of the car do this
Code: Select all
 car.y=((tire1.y+tire2.y)/2)-20;

so the car will always be the avrage height of the tires and a litille bit higher(-20).

To make the car lean back and forward just use the diference betwen the height of the tires and link it with animpos.

Hope this helps i know your ordeal i had three tires and a cannon
:(

PostPosted: Mon Dec 05, 2005 8:38 pm
by ericdg
Can novice or someone help me out.

I know I need to use animpos but I don't know how.

I used your script below

int shooterangle;
shooterangle=direction(shooter.x,shooter.y,a.x,a.y);
animpos=shooterangle/22.5;


But I don't know what anything means. I made 9 image files ranging from 40 degrees and one direction to 40 in the other. How do I put how many images it needs to use and how does it know where to start.

I have a car actor on top of two tire actors and when I drive it, the animation changes at all the wrong times.

Thanks guys, I'll get the hang of this yet.