Help with character movement ....

Posted By: bk9iq

Help with character movement .... - 07/29/10 20:07

Hello,
I am using pXent_movechar(...) to move my character... I am using the exact same example that is in the manual:

Quote:
...
pXent_settype(me,PH_CHAR,PH_CAPSULE);
...
while(1) { move_char(); wait(1); }
}
...function move_char()
{
VECTOR mov = vector(0,0,0);
if(key_w) mov.x= 8*time_step;
if(key_s) mov.x=-8*time_step;
if(key_a) mov.y= 8*time_step;
if(key_d) mov.y=-8*time_step;
vec_rotate(mov,camera.pan);
mov.z=0; // must be set, because vec_rotate sets mov.z when the camera looks up/down.
pXent_movechar(me, mov, camera.pan, 0);
}


However, I deleted the underlined line : mov.z=0; and added ::
Quote:
if(key_space) mov.z=8*time_step;


The player never moves up not even a little when I press space... Could u plz tell me what I am doing wrong??
Can somebody try it?
Posted By: Lukas

Re: Help with character movement .... - 07/29/10 20:11

I think you meant +=, not =.
Posted By: bk9iq

Re: Help with character movement .... - 07/30/10 02:57

Oh that's a mistake I made while writing the topic here...

here's my code.... Space doesn't change anything

Link to Download

Thanks
Posted By: bk9iq

Re: Help with character movement .... - 07/30/10 16:36

Is it impossible to move in the Z direction while applying physics or this is a bug??
Posted By: Widi

Re: Help with character movement .... - 07/30/10 17:24

If a object is register as physic, you don`t can move this object with c_move (if you mean this with move in z direction)
Posted By: bk9iq

Re: Help with character movement .... - 07/30/10 17:28

Thanks Widi for answering me ....
I am not using c_move... I am using:
if(key_space) mov.z+=8*time_step;
and
pXent_movechar(me, mov, nullvector, 0);

to move it but whenever I press the space it doesn't move up?? I uploaded the file.. I just wanna know what is wrong...

here's the file again
http://www.mediafire.com/?6qodxbb08r1ls4z
© 2024 lite-C Forums