Is there a way to link actors other than parenting?

Talk about making games.

Is there a way to link actors other than parenting?

Postby ericdg » Tue Nov 29, 2005 5:11 pm

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.
ericdg
 
Posts: 53
Joined: Tue Nov 29, 2005 1:18 pm
Score: 1 Give a positive score

Postby willg101 » Tue Nov 29, 2005 9:33 pm

You could use the code
Code: Select all
x=LinkedActor.x
y=LinkedActor.y
on draw actor.
http://www.wish-games.com
Old betas now available!!
User avatar
willg101
 
Posts: 473
Joined: Thu Dec 16, 2004 12:08 am
Location: West Michigan
Score: 5 Give a positive score

Postby ingsan » Wed Nov 30, 2005 8:44 am

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
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby ericdg » Thu Dec 01, 2005 3:38 am

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.
ericdg
 
Posts: 53
Joined: Tue Nov 29, 2005 1:18 pm
Score: 1 Give a positive score

Postby willg101 » Thu Dec 01, 2005 9:58 pm

It's going to be quite hard to make the wheels flip with the car if they are seperate actors. :?
http://www.wish-games.com
Old betas now available!!
User avatar
willg101
 
Posts: 473
Joined: Thu Dec 16, 2004 12:08 am
Location: West Michigan
Score: 5 Give a positive score

Postby makslane » Fri Dec 02, 2005 12:28 am

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?
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby ericdg » Fri Dec 02, 2005 2:11 pm

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.
ericdg
 
Posts: 53
Joined: Tue Nov 29, 2005 1:18 pm
Score: 1 Give a positive score

Postby Novice » Fri Dec 02, 2005 3:55 pm

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
:(
Why do i always get stuck?
User avatar
Novice
 
Posts: 399
Joined: Mon Aug 29, 2005 10:54 am
Location: Relative
Score: 5 Give a positive score

Postby ericdg » Mon Dec 05, 2005 8:38 pm

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.
ericdg
 
Posts: 53
Joined: Tue Nov 29, 2005 1:18 pm
Score: 1 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron