Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,619 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
help!! #381287
08/26/11 01:23
08/26/11 01:23
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
F
Funeral Offline OP
Junior Member
Funeral  Offline OP
Junior Member
F

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] #381313
08/26/11 11:46
08/26/11 11:46
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline
Serious User
Aku_Aku  Offline
Serious User

Joined: Sep 2009
Posts: 1,032
Budapest
Expand the statement if(floor < alt) with examination of floor, like this if(floor < alt && floor > 0 && floor < 3).
you can tune the constant value 3 to guess out which value is fit for you.

Re: help!! [Re: Aku_Aku] #381365
08/27/11 02:00
08/27/11 02:00
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
F
Funeral Offline OP
Junior Member
Funeral  Offline OP
Junior Member
F

Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
what code would tell me exactly when the player is on the floor? coz the "floor < alt" means the that player's position is less than alt but still is in the air...

Re: help!! [Re: Funeral] #381396
08/27/11 15:00
08/27/11 15:00
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline
Serious User
Aku_Aku  Offline
Serious User

Joined: Sep 2009
Posts: 1,032
Budapest
It depends on what shape has the floor and what is the coordinates of the top surface of that.

Re: help!! [Re: Aku_Aku] #381417
08/27/11 18:11
08/27/11 18:11
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
F
Funeral Offline OP
Junior Member
Funeral  Offline OP
Junior Member
F

Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
the level its just a hollow cube and blocks. its a simple 3dr person plataform game =)

Re: help!! [Re: Funeral] #381421
08/27/11 19:37
08/27/11 19:37
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline
Serious User
Aku_Aku  Offline
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.
Re: help!! [Re: Aku_Aku] #382584
09/09/11 18:35
09/09/11 18:35
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
F
Funeral Offline OP
Junior Member
Funeral  Offline OP
Junior Member
F

Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
still unsolved!! frown i almost got it but the problems is that i can jump on the air, so what i what is that the key space turns unable while the player is in the air, and get able only when it touches the floor to be able to jump again..

Re: help!! [Re: Funeral] #382597
09/09/11 21:42
09/09/11 21:42
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline
Serious User
Aku_Aku  Offline
Serious User

Joined: Sep 2009
Posts: 1,032
Budapest
if(key_space && alt==0)


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1