Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,454 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Jumping! #189729
03/21/08 05:29
03/21/08 05:29
Joined: Jan 2008
Posts: 10
Brisbane, Australia
J
JJJohan Offline OP
Newbie
JJJohan  Offline OP
Newbie
J

Joined: Jan 2008
Posts: 10
Brisbane, Australia
I've got a reasonably game together now, but I really can't figure out how to allow the player to jump. Either I'm completely confused and I'm stuck on something easy or I'm just doing it wrong, but nothing seems to work.

I'm currently using the movement system from workshop 23 (one of the tutorials) just to stuff around, I've added quite a few features which I'm happy with, but what I'm lacking most right now is jumping.

I tried searching around but surprisingly I haven't found any code or questions/answers related to it. I may have just searched improperly but I tried.

Any help is appreciated.

Re: Jumping! [Re: JJJohan] #189730
03/21/08 13:58
03/21/08 13:58
Joined: Nov 2006
Posts: 193
England
RyuShinji Offline
Member
RyuShinji  Offline
Member

Joined: Nov 2006
Posts: 193
England
There's lots of ways to attempt jumping in 3DGS, the one i use is the one from the "khmovement" tutorial it can be found in AU Resources tutorial page on the 3DGS home page

here's a direct link to the tutorial:

http://www.coniserver.net/coni_users/web_users/pirvu/au/tutorials/zipped/khmovement.zip

Re: Jumping! [Re: RyuShinji] #189731
03/22/08 08:55
03/22/08 08:55
Joined: Jan 2008
Posts: 10
Brisbane, Australia
J
JJJohan Offline OP
Newbie
JJJohan  Offline OP
Newbie
J

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 Offline
Member
RyuShinji  Offline
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
J
JJJohan Offline OP
Newbie
JJJohan  Offline OP
Newbie
J

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.

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