Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, bigsmack, 7th_zorro, dr_panther), 1,364 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Bouncing problem. #145414
08/03/07 06:49
08/03/07 06:49
Joined: Dec 2006
Posts: 20
Spector Offline OP
Newbie
Spector  Offline OP
Newbie

Joined: Dec 2006
Posts: 20
Hello.

For the past few days I have been doing the shooter tutorials by Gimber..or grimber..or whatever his name is.

I was finishing up the last part of the first one, where you make yourself be able to fall and jump.
Well, it mention how that if you run it in the current state, you will bounce when you land, so move this part of code to this part, or somthing like that.
When I ran it, shure enough, I bounced, but when I did what it said, I STILL bouced.

I think the problem is that it makes me stand when the landing animation is done, but it doesnt finish in time or somthing..
I'll post the code.

Code:
 //// FPS.wdl
var video_mode = 7;
var video_depth = 16;
var video_screen = 1;
var move_vec[3] = 0,0,0;

function main()
{
level_load ("FPS.wmb");
wait(2);
fps_max = 51;
}

//player variablles
var idle_percent = 0;
var walk_percent = 0;
var run_percent = 0;
Var land_percent = 60;
var temptilt = 0;

action player_move
{
{
player = me;
wait(1);
DEFINE falling,skill30; // 0 for not falling 1 for falling
DEFINE fall_distance,skill31; // distance to fall
My.falling = 0; // I’m not falling
camera.genius = player;
My.falling = 0; // I’m not falling
while (player !=NULL)
{

//checks distance to ground
vec_set(temp,my.x);
temp.z -= 4000;
trace_mode = ignore_me+ignore_sprites+IGNORE_MODELS+USE_BOX;
my.fall_distance = trace(my.x,temp);

If (my.fall_distance >64 && sign(my.fall_distance) != -1)
{
my.falling = 1; // now I’m falling
}
else
{
if ( my.fall_distance < 64 && my.falling == 0 ) // keep us on the floor normally
{
move_vec.z = -my.fall_distance*3*time;
}
}

// add all this in after the above lines
if (!my.falling){ // if falling = 0 then !falling is = 1, or true that I&#8217;m not falling
if (key_shift){
//fowards and backwards
move_vec[0] = (key_w - key_s)*6 *time;
//strafe
move_vec[1] = (key_a - key_d) *4 *time;
}
else
{
//fowards and backwards
move_vec[0] = (key_w - key_s)*12 *time;
//strafe
move_vec[1] = (key_a - key_d) *8 *time;
}
}

If (my.fall_distance >32)
{
my.falling = 1; // now I'm falling
if (move_vec.z > -20*time) // if not falling at maximum fall rate
{
move_vec.z -= .5*time; // then increase my fall rate
}
}

//turn left and right
player.pan -= mouse_force.x *8 *time;

//ANIMATIONS
//falling AND stop.
if (my.falling == 1)
{
if (my.fall_distance > 32)
{
ent_animate(me,"jump",60,anm_add);
}
else
{
if (int(land_percent) !=0 ) // not done with animation yet
{
land_percent = (land_percent +8*time)%100;
ent_animate(me,"jump",land_percent,ANM_ADD); // animate landing
if (my.fall_distance < 0) // have I fallen under a surface?
{
move_vec.z = -my.fall_distance*time; // if so, move me back up
}
}
else // landing animation done
{
my.falling = 0; // we are no longer falling
land_percent = 60; // reset land_percent for the next time we might fall
}
}
}
else{
//ANIMATIONS
//standing animations
If (move_vec[0] == 0 && move_vec[1] == 0)
{
idle_percent = (idle_percent +5*time)%100;
ent_animate(me,"idle",idle_percent,ANM_CYCLE);
}
else
{
// our movement animations will go here
if (key_shift) // either shift key is being pressed
{
walk_percent = (walk_percent + sign(move_vec[0])*5*time)%100;
ent_animate(player,"walk",walk_percent,ANM_CYCLE);
}
else // shift key is NOT being pressed so we are walking
{
run_percent = (run_percent + sign(move_vec[0])*9*time)%100;
ent_animate(player,"run",run_percent,ANM_CYCLE);
}
}
}

//set how I hit things
move_mode = IGNORE_YOU + IGNORE_PASSABLE + IGNORE_PUSH + ACTIVATE_TRIGGER + GLIDE;
//move abject
ent_move(move_vec,NULLVECTOR);

/*
vec_set(temp,my.x); // copies my loc to temp
vec_sub(temp,camera.x); // subtracts camera loc from temp to calculate a direction vector from camera to my
vec_to_angle(camera.pan,temp); // rotates pan and tilt of the camera to the temp direction vector
*/

//CAMERA UPDATES
//Camera goes to eyes
vec_set (Camera.x,player.x);
camera.z += 27;

//turns with player
camera.pan = player.pan;

//tilts with player
temptilt += mouse_force.y * 8 * time;

//limit tilt
if (temptilt > 75)
{
temptilt = 75;
}
else
{
if (temptilt < -75)
{
temptilt = -75;
}
}
camera.tilt =0 +temptilt;

wait(1);
}
}
}



I'll be more than happy to send the project to you, but I dont have time to host it, so you would need to post/message me you E-mail. Dont torry, you can trust me.

Re: Bouncing problem. [Re: Spector] #145415
08/04/07 18:09
08/04/07 18:09
Joined: Dec 2006
Posts: 20
Spector Offline OP
Newbie
Spector  Offline OP
Newbie

Joined: Dec 2006
Posts: 20
Anyone? I can send the project to you, but I cant host it right now.

Re: Bouncing problem. [Re: Spector] #145416
08/05/07 01:12
08/05/07 01:12
Joined: Sep 2002
Posts: 700
Orange County, CA
L
LogantheHogan Offline
Developer
LogantheHogan  Offline
Developer
L

Joined: Sep 2002
Posts: 700
Orange County, CA
Hmm. I'd like to take a look at the tutorial to see his reasoning. Can you post a link to the tutorial, or else can you post a direct quote about what he says regarding the bouncing?

Re: Bouncing problem. [Re: LogantheHogan] #145417
08/05/07 03:53
08/05/07 03:53
Joined: Dec 2006
Posts: 20
Spector Offline OP
Newbie
Spector  Offline OP
Newbie

Joined: Dec 2006
Posts: 20
Alright. The link is right here.

He teaches you how to fall towards the bottom, but up some. You will see the cbabe model with some ramps.
If it does not seem to want to load right away, just give it a second. I believe it is an older document, and the reader is converting it.


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