Detecting Distance between MainActor and another object.

Talk about making games.

Detecting Distance between MainActor and another object.

Postby ingsan » Tue May 18, 2004 5:02 pm

Hello everyone !

I have a little problem to solve.
I have 2 actors : MainActor and Ball.
MainActor throws the Ball with a random angle and velocity so that the Ball will not fall at the same distance from him all the time.

Image

Everytime Main throws Ball, the distance made between the two actors appear on screen.

How can I detect That distance ?

Thnak you for any help :wink:
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 ingsan » Tue May 18, 2004 6:42 pm

I succeeded in detecting the distance between two actors and in making that distance appear on screen :P It was just too simple :oops:

Now I'm going to try to make the shoot of the Ball actor with a specific velocity and angle.

GAME :
    A Ball is thrown to Main from someone found above him.
    Main has a baseball bat and has to kick the Ball as far as possible.
    If Main kicks too soon, the Ball goes too high in the sky and so makes a too small distance.
    If Main kicks too late, the Ball falls to the ground thus making 0 distance !


I would like to have a smooth and not factice Ball movement. I know I can work that with Physical Response, but do you have any tip so that I can work this all with scripting ?

Thanks !
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 makslane » Wed May 19, 2004 12:38 pm

Initial move:

ball.diretional_velocity = ...
ball.angle = ...

Gravity:

On ball Draw Actor event
yvelocity = yvelocity + ...

Bounce:

On ball collision with ground:
PhysicalResponce

or

yvelocity = -yvelocity*.8;
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby ingsan » Thu May 20, 2004 9:49 am

You're Right !
Thanks 8)
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron