0 registered members (),
1,454
guests, and 8
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Jumping!
[Re: RyuShinji]
#189731
03/22/08 08:55
03/22/08 08:55
|
Joined: Jan 2008
Posts: 10 Brisbane, Australia
JJJohan
OP
Newbie
|
OP
Newbie
Joined: Jan 2008
Posts: 10
Brisbane, Australia
|
Thanks! Cool, I've got jumping working. One more problem though. The player can only jump once. It seems it is waiting for a variable to change till it allows the user the jump again but I can't figure out what. There are no animations in my player, so I removed all of the animation checks. Do I have to replace those or something? Code:
FUNCTION handle_gravity() {
trace_mode = ignore_me+ignore_passable+use_box; result = trace(vector(my.x,my.y,my.z - my.z_offset),vector(my.x,my.y,my.z - 4000)); IF (result < 3) { IF (my.jumping_mode == 0) { my.force_z = -1 * result; IF (key_space == 0 && space_press == 1) { space_press = 0; } IF (key_space == 1 && space_press == 0 && my.movement_mode == 0) { space_press = 1; my.jumping_mode = 1; my.force_z = 25; } } IF (my.jumping_mode == 2 || my.jumping_mode == 3) { my.jumping_mode = 0; } } ELSE { IF (my.jumping_mode == 2) { IF (result > 120) { my.jumping_mode = 3; } ELSE { my.jumping_mode = 0; } } IF (my.jumping_mode == 3 && result <= 120) { my.jumping_mode = 0; } IF (my.jumping_mode == 0 && my.movement_mode == 0) { IF (result > 120) { my.jumping_mode = 3; } } my.force_z -= my.gravity * time; my.force_z = max(-30,my.force_z); IF (my.movement_mode == 2) { my.force_z = 0; } } my.velocity_z += (time * my.force_z) - (min(time*0.7,1) * my.velocity_z); my.move_z = my.velocity_z * time; }
|
|
|
Re: Jumping!
[Re: JJJohan]
#189732
03/22/08 12:53
03/22/08 12:53
|
Joined: Nov 2006
Posts: 193 England
RyuShinji
Member
|
Member
Joined: Nov 2006
Posts: 193
England
|
I think i know what the problem is, yes you're right you have to replace them with something.
} IF (my.animblend == jump || my.animblend == fall) { IF (my.jumping_mode == 3) { my.animate = 60; } ent_animate(my,"jump",my.animate,0); my.animate += 10 * animation_speed * time; my.currentframe = jump; IF (my.animate >= 60 && my.jumping_mode == 1) { my.jumping_mode = 2; } IF (my.animate >= 100) { ent_animate(my,"jump",100,0); my.animate = 100; my.blendframe = stand; IF (my.move_x != 0 || my.move_y != 0) { IF (key_shift == 1) { my.blendframe = walk; } ELSE { my.blendframe = run; } } } }
as you could tell alot relys on the animation not all of it but alot, so i guess you would have to replace the animation skill-checks with fake ones, you might be able to make a function that slowly increases a skill like "jumping" from 1 to 100 and have it check that insted of the animation % i'm sure that would work ...
but if you are going to have animations evantualy anyway it would be better to create some temp animation so you don't have to change too much code...
Hope that helps, GOOD LUCK!
Oh, P.S i think jumping has to = 0 to jump again...
Last edited by RyuShinji; 03/22/08 13:00.
|
|
|
Re: Jumping!
[Re: RyuShinji]
#189733
03/23/08 08:42
03/23/08 08:42
|
Joined: Jan 2008
Posts: 10 Brisbane, Australia
JJJohan
OP
Newbie
|
OP
Newbie
Joined: Jan 2008
Posts: 10
Brisbane, Australia
|
I'll see what I can do on replacing the code. I don't think temporary animations will do me any good. Not that it's a bad idea but, when it comes to animations, modelling or texturing, I'm hopeless. I could spend weeks on trying to figure out how to assemble a cube in 3DS Max, texture it, and somehow animate it and probably I'll end up stuffing up anyway. I tried some tutorials but I guess I'm just not one of the creative people. Guess that'll only leave me to replace it with fake animation checks. Edit:Well, it's doing something but I still have no luck. After failing to produce a proper replacement for the animation check I decided against all odds to just use a timer and force jumping_mode to 0. Surprisingly, it worked. I can jump more than once now. However, all jumps after the first are extremely low and for the past 2 hours I've had no luck changing this. Such a small bit of code with such great confusion .
Last edited by JJJohan; 03/23/08 10:23.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|