0 registered members (),
1,397
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Can you help me with this function?
[Re: DiegoFloor]
#256020
03/14/09 07:24
03/14/09 07:24
|
Joined: Jan 2009
Posts: 86 Brasil - RS
DiegoFloor
Junior Member
|
Junior Member
Joined: Jan 2009
Posts: 86
Brasil - RS
|
This is a working code
#include <acknex.h>
#include <default.c>
ENTITY* ball;
ENTITY* ball2;
action action_ball()
{
VECTOR velocity;
var magnitude = 0.1;
while(!key_space){wait(1);} //press space to start the chase!
while(1)
{
vec_diff(velocity, ball2.x, me.x);
vec_normalize(velocity, magnitude);
magnitude +=0.003;
c_move(me, nullvector, velocity, IGNORE_MAPS);
wait(1);
}
}
action action_ball2()
{
while(!key_space){wait(1);}
while(1)
{
c_move(me,nullvector, vector(10*time_step,0,0),NULL);
wait(1);
}
}
function main()
{
mouse_mode = 1;
level_load("some_map.wmb");
wait (2);
ball2 = ent_create ("ball.mdl", vector(-100, -200, 0), action_ball2);
ball = ent_create ("ball.mdl", vector(100, 100, 0), action_ball);
vec_set(camera.x, vector(0,0,600));
while(1)
{
camera.pan -= mouse_force.x * 12 * time_step;
camera.tilt += mouse_force.y * 8 * time_step;
wait(1);
}
}
|
|
|
Re: Can you help me with this function?
[Re: DiegoFloor]
#256212
03/15/09 11:04
03/15/09 11:04
|
Joined: Aug 2008
Posts: 49
Vyse220
OP
Newbie
|
OP
Newbie
Joined: Aug 2008
Posts: 49
|
thx! you helped me a lot! the only problem is that the player sometimes get hit by this things and my.passable = on; is set Oo However, thx
|
|
|
Re: Can you help me with this function?
[Re: Vyse220]
#256235
03/15/09 14:33
03/15/09 14:33
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
add the IGNORE_PASSABLE flag to the c_move calls in the actions of the entities that are hitting him. EG: c_move(me, nullvector, velocity, IGNORE_MAPS|IGNORE_PASSABLE);
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|