Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, TedMar), 1,031 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
problems with wdl player jumping #335136
07/26/10 21:23
07/26/10 21:23
Joined: Jul 2008
Posts: 22
Bayern
CrYzZeR Offline OP
Newbie
CrYzZeR  Offline OP
Newbie

Joined: Jul 2008
Posts: 22
Bayern
English:

Hello Guys.

I have a player wdl Code from the Aum (thanks Georg) and have it a little bit modified. but the Problem is, when i jump the player keeps exactly the jump height. Thats a problem when I jump over a hole for example, because the player falls into the hole and stopps when the coded jump height is reached. Sry for my bad english I hope you know what i mean. Can you help me? The code is down my post.

Deutsch:

Hallo Gamestudio User!

Ich habe hier einen Player code von dem AUM Magazine (danke georg)
ich habe ihn leicht modifiziert und er funktioniert ganz gut soweit.
Nur habe ich ein Problem:
Wenn ich springe, wird die exakte Sprunghöhe eingehalten. Das ist aber ein Problem wenn ich zum Beispiel über ein Loch springen will. Weil der Player dann soweit hineinfällt, bis die maximale Sprunghöhe wieder erreicht ist. Ich möchte aber, dass er ganz normal drüberspringen kann.

Ich habe mir überlegt, dass ich irgendwie von einer anderen Position aus die maximiale Sprunghöhe festlegen sollte. Diese Position müsste ja aber dann undter meinen wegen usw. gehen wo ich später mit meinem Player entlanglaufe. Oder habt ihr andere Ideen?

Bin noch kein Proficoder also wenns geht bitte etwas ausführlicher ( ist nicht böse gemeint wink )

Danke schonmal für eure Aufmerksamkeit grin


E: Heres the code:
DE: Hier ist der Code:

Click to reveal..

action players_code

{


var anim_percentage; // animation percentage

var jump_percentage; // animation percentage for jumping

var movement_speed; // player's movement speed

var distance_to_ground; // the distance between player's origin and the ground

var jump_height;

var reached_height;

player = my; // I'm the player

while (1)

{
camera.x = player.x - 100;

camera.y = player.y - 400; // play with 400

camera.z = player.z + 120; // play with 120

camera.pan = player.pan + 50; // play with 90
vec_set (temp.x, my.x); // copy player's position to temp

temp.z -= 5000; // set temp.z 5000 quants below player's origin

distance_to_ground = c_trace (my.x, temp.x, ignore_me | use_box);

movement_speed.x = 8* (key_cur - key_cul) * time;

movement_speed.y = 0; // don't move sideways

movement_speed.z = - (distance_to_ground - 5); // 17 = experimental value

movement_speed.z = max (-40 * time, movement_speed.z); // 35 = falling speed

if ((key_space == on) && (reached_height == 0))

{

jump_height = min(50, jump_height + 8 * time); // 40 sets the height, 5 sets the ascending speed

if (jump_height == 50) // reached the maximum height? Then start descending!

{

reached_height = 1;

jump_height = max(0, jump_height - 8 * time); // 5 sets the falling speed

}

}

else // space isn't pressed anymore?

{

jump_height = max(0, jump_height - 3 * time); // use a smaller falling speed (3) for (potential) smaller jumps

if ((jump_height == 0) && (key_space == off)) // the player has touched the ground?

{

reached_height = 0; // then allow it to jump again

}

}

movement_speed.z = - (distance_to_ground - 0) + jump_height; // 17 = experimental value

movement_speed.z = max (-35 * time, movement_speed.z); // 35 = falling speed

c_move (my, movement_speed.x, nullvector, glide); // move the player

if (jump_height == 0) // the player isn't jumping?

{

if ((key_cur == off) && (key_cul == off)) // the player isn't moving?

{

ent_animate(my, "stand", anim_percentage, anm_cycle); // play the "stand" animation

}

else // the player is moving?

{

ent_animate(my, "walk", anim_percentage, anm_cycle); // play the "walk" animation

}

anim_percentage += 5 * time; // 5 = animation speed

jump_percentage = 0; // always start jumping with the first frame

}

else // the player is jumping

{

jump_percentage += 5 * time; // 5 = jump animation speed

ent_animate(my, "jump", jump_percentage, anm_cycle); // play the "jump" animation




}

wait (1);

}

}




I want to Entertain you...
Re: problems with wdl player jumping [Re: CrYzZeR] #335458
07/28/10 16:39
07/28/10 16:39
Joined: Jul 2008
Posts: 22
Bayern
CrYzZeR Offline OP
Newbie
CrYzZeR  Offline OP
Newbie

Joined: Jul 2008
Posts: 22
Bayern
Hmm, or does anybody have a free to use Jump n run wdl code who don`t have this Problem? It would be very very nice when anybody can give me someone.

Greets


I want to Entertain you...
Re: problems with wdl player jumping [Re: CrYzZeR] #335576
07/29/10 13:31
07/29/10 13:31
Joined: Apr 2006
Posts: 159
Latvija
Arrovs Offline
Member
Arrovs  Offline
Member

Joined: Apr 2006
Posts: 159
Latvija
You should give vertical power impulse.
And constant downforce if height over earth is bigger then 0.

while(blabla)
{
result=trace(my.pos,vector(my.x,my.y,my.z-2000));
if(result>1){gravity.z-=1*time_step;}
else{gravity.z=0;}
//jump power
if(result=<0&&key_space==1)
{gravity.z=10;}
c_move(my,standart_movement,gravity,blabla);
wait(1);
}

I wrote it very fast so here is main idea.
But it works.
If result dont work well with 0 then use 1.

Last edited by Arrovs; 07/29/10 13:31.

Arrovs once will publish game
Re: problems with wdl player jumping [Re: Arrovs] #337497
08/11/10 09:41
08/11/10 09:41
Joined: Jul 2008
Posts: 22
Bayern
CrYzZeR Offline OP
Newbie
CrYzZeR  Offline OP
Newbie

Joined: Jul 2008
Posts: 22
Bayern
thank you. I will try it.


I want to Entertain you...

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