Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (RealSerious3D, rvl), 1,187 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
squik, AemStones, LucasJoshua, Baklazhan, Hanky27
19060 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: 993
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

Joined: Sep 2009
Posts: 993
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: 993
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

Joined: Sep 2009
Posts: 993
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: 993
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

Joined: Sep 2009
Posts: 993
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: 993
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

Joined: Sep 2009
Posts: 993
Budapest
if(key_space && alt==0)


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

Gamestudio download | chip programmers | 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