2 registered members (TipmyPip, 1 invisible),
18,699
guests, and 8
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
calculating vec_dist as part of an action
#325736
05/27/10 21:30
05/27/10 21:30
|
Joined: Apr 2010
Posts: 59 Lagos, Nigeria
gameaddict
OP
Junior Member
|
OP
Junior Member
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
|
I'm trying to get the location of my player and the ball entity on my level so I can decide if he can move with the ball or not but the vec_dist function causes a crash in the action at the start of the game.
Second problem is that if I don't use the vec_dist, the ball moves with the player but appears at it's original location immediately I release the buttons I assigned to move the ball's x and y positions. Is it because I'm changing x and y positions directly and somehow not making them permanent? How do I set the ball to stop returning to it's former position. I need to make every current location it's location.
I know I can.
|
|
|
Re: calculating vec_dist as part of an action
[Re: Damocles_]
#325742
05/27/10 22:18
05/27/10 22:18
|
Joined: Apr 2010
Posts: 59 Lagos, Nigeria
gameaddict
OP
Junior Member
|
OP
Junior Member
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
|
All the entities are added in WED and assigned their actions. The vec_dist always crashes when it is called any function in which I add it.
I know I can.
|
|
|
Re: calculating vec_dist as part of an action
[Re: Damocles_]
#325748
05/27/10 22:50
05/27/10 22:50
|
Joined: Apr 2010
Posts: 59 Lagos, Nigeria
gameaddict
OP
Junior Member
|
OP
Junior Member
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
|
The free version. It's the latest one on the download page.
I know I can.
|
|
|
Re: calculating vec_dist as part of an action
[Re: Damocles_]
#325754
05/27/10 23:31
05/27/10 23:31
|
Joined: Apr 2010
Posts: 59 Lagos, Nigeria
gameaddict
OP
Junior Member
|
OP
Junior Member
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
|
okay Here, it's supposed to check the distance between player and the ball and if close enough, call the necessary function but it the action crashes at start
action theBall()
{
set(my, SHADOW);
phent_settype(my, PH_RIGID, PH_SPHERE);
phent_setmass(my, 1, PH_SPHERE);
phent_setfriction(my,90);
phent_setelasticity(my,75,100);
phent_setdamping(my,30,5);
phent_addvelcentral(my,vector(10,10,0));
ph_setgravity(vector(0,0,-500));
my.emask |= ENABLE_FRICTION;
while(1){
if(vec_dist(my.x, player.x) < 20){
move_with_ball();
}
if(key_x){
kick();
}
wait(1);
}
}
I know I can.
|
|
|
Re: calculating vec_dist as part of an action
[Re: gameaddict]
#325755
05/27/10 23:35
05/27/10 23:35
|
Joined: Oct 2007
Posts: 5,211 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
|
put while(!player) wait(1);
at the very begining of the action.
3333333333
|
|
|
|