1 registered members (TipmyPip),
18,619
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
help!!
#381287
08/26/11 01:23
08/26/11 01:23
|
Joined: Dec 2008
Posts: 83 Buenos Aires, Argentina
Funeral
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
|
hi, i have this code for jumping but it needs to be fixed..
var alt = 20;
player script var floor; VECTOR temp; vec_set(temp.x, my.x); temp.z -= 10000; floor = c_trace(my.x, temp.x, IGNORE_ME | IGNORE_PASSABLE | USE_BOX | GLIDE);
{ if(floor < alt) { if(key_space) { c_move(me,vector(0, 0, 10*time_step),nullvector, GLIDE); if(floor > alt) { c_move(me,vector(0,0,-1*time_step),nullvector, GLIDE); } } }
its for jumping, and the idea its that when the player has reached the max altitud ( var alt = 20) the key has to get disable until the player touches the ground again, the problem its that the "if(floor < alt)" allows the player to jump not only when the player is in the air, but any moment as is in the air aswell.. so i dont know how to do to recognize when the player is on the floor to get the key to be able to jump again.
|
|
|
Re: help!!
[Re: Funeral]
#381421
08/27/11 19:37
08/27/11 19:37
|
Joined: Sep 2009
Posts: 1,032 Budapest
Aku_Aku
Serious User
|
Serious User
Joined: Sep 2009
Posts: 1,032
Budapest
|
I think the floor is the lower side of the cube. The floor position is: 1. z value of the cube's origin place vector (height from world 0,0,0 point) plus 2. the distance of the cube's origin from the lower side.
This sum gives surface's ground zero in world coordinates. IMHO (Naturaly substitute the plus operation with minus :))
Last edited by Aku_Aku; 08/27/11 19:39.
|
|
|
|