|
2 registered members (3run, AndrewAMD),
623
guests, and 1
spider. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Game
#174429
12/22/07 22:52
12/22/07 22:52
|
Joined: Sep 2006
Posts: 292
Mythran
OP
Member
|
OP
Member
Joined: Sep 2006
Posts: 292
|
Hello all. I'm having several problems with the player scripts from Kingdom Hearts. If anyone please could fix it and send it back i would apreciate alot. Know problems: - When i stand down the stairs and jump, the player passes through it and jumps even higher. - When i collide with the barrel, instead of collision it walks over it. - When jumping to objects player constantly sinks in objects. - When i jump to the spider it stucks. - When i have through the window it stucks, intead of collide with the wall. I think the problems are relationated with gravity and collision, i tryed severeal times to fix it, but it just got worst. Thanks in advance. Game Sources: http://www.badongo.com/file/7002784
|
|
|
Re: Game
[Re: Mythran]
#174430
12/30/07 17:51
12/30/07 17:51
|
Joined: Sep 2006
Posts: 292
Mythran
OP
Member
|
OP
Member
Joined: Sep 2006
Posts: 292
|
I have kind of resolved the problems with the stairs  I forgot to add the action to it. Please can anyone at least comment anything? Or have a way to solve any of the problems. I really need help with this. Thanks
|
|
|
Re: Game
[Re: Mythran]
#174431
12/30/07 21:16
12/30/07 21:16
|
Joined: Sep 2003
Posts: 5,900 Bielefeld, Germany
Pappenheimer
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
|
I had a look into your level and a look in the player.wdl.
Search in the manual for "aabb" and "obb", for "collision", and look for "c_move" and "c_trace" in the manual and in the script. Use the search functions.
It is all about the collision. Collision depends on the on the terms that I mentioned. It isn't easy to understand. Probably, it is the best to use two different models, a more simple one for collision and a good looking one for the visible.
For instance, the window: you have to decide, whether the player should be able to jump through the window, then you should make it bigger, otherwise you should place an invisible wall to stop him from getting through or getting stuck.
For the barrels: you need a special action to move them when pushed by the player. You need an action which has to be 'synchronized' with the player's action.
|
|
|
Re: Game
[Re: Pappenheimer]
#174432
01/01/08 21:35
01/01/08 21:35
|
Joined: Sep 2006
Posts: 292
Mythran
OP
Member
|
OP
Member
Joined: Sep 2006
Posts: 292
|
FUNCTION handle_movement() { temp.x = -1000; temp.y = 0; my.moving = 0; IF (key_w == 1 && key_s == 0 && key_a == 0 && key_d == 0) { temp.x = camera.pan; } IF (key_s == 1 && key_w == 0 && key_a == 0 && key_d == 0) { temp.x = camera.pan + 180; } IF (key_a == 1 && key_s == 0 && key_w == 0 && key_d == 0) { temp.x = camera.pan + 90; } IF (key_d == 1 && key_s == 0 && key_a == 0 && key_w == 0) { temp.x = camera.pan - 90; } IF (key_w == 1 && key_a == 1 && key_d == 0 && key_s == 0) { temp.x = camera.pan + 45; } IF (key_w == 1 && key_d == 1 && key_a == 0 && key_s == 0) { temp.x = camera.pan - 45; } IF (key_s == 1 && key_a == 1 && key_d == 0 && key_w == 0) { temp.x = camera.pan + 135; } IF (key_s == 1 && key_d == 1 && key_a == 0 && key_w == 0) { temp.x = camera.pan - 135; } IF (temp.x != -1000) { my.moving = 1; IF (key_shift == 1) { temp.y = 10 * time; } ELSE { temp.y = 15 * time; } }
IF (my.movement_mode == 0) { my.move_x = fcos(temp.x,temp.y); my.move_y = fsin(temp.x,temp.y); } IF (my.movement_mode == 1 || my.movement_mode == 2) { temp.y = fsin((my.animate * 1.2) + 45,15 * time); my.move_x = fcos(my.pan,temp.y); my.move_y = fsin(my.pan,temp.y); temp.y = 0; IF (temp.x != -1000) { //if we need to rotate whilst attacking (the player is pressing keys to rotate) temp.y = 1; } } scan_floor(); c_move(my,nullvector,my.move_x,use_aabb | ignore_passable | glide); //c_move(my,nullvector,my.move_x,use_aabb | ignore_passable | glide); result = trace(vector(my.x,my.y,my.z - my.z_offset),vector(my.x,my.y,my.z - 4000)); //result = c_trace(my.x,vector(my.x,my.y,my.z - 4000),use_box| ignore_me |ignore_passable); IF (result < 0) { my.z -= result; my.velocity_z = 0; }
IF (target_enemy == null) { IF (temp.y > 0) { rotate_entity(temp.x,30); } } ELSE { vec_diff(temp2.x,target_enemy.x,my.x); vec_to_angle(temp2.pan,temp2.x); rotate_entity(temp2.pan,30); }
IF (my.movement_mode == 0) { my.gravity = 6; IF (my.move_x != 0 || my.move_y != 0) { //if we are moving IF (my.animblend == stand) { //if our current animation is stand IF (key_shift == 1) { my.blendframe = walk; } ELSE { my.blendframe = run; } } IF (my.animblend == run && key_shift == 1) { my.blendframe = walk; } IF (my.animblend == walk && key_shift == 0) { my.blendframe = run; } } ELSE { IF (my.animblend > stand && my.animblend != jump && my.animblend != fall) { //if we arn't moving and our current animation is walk or run, blend and cycle the stand animation my.blendframe = stand; } } IF (mouse_left == 0 && mouse_left_press == 1) { mouse_left_press = 0; } IF (mouse_left == 1 && mouse_left_press == 0 && my.animblend >= stand) { mouse_left_press = 1; my.blendframe = attack_a; IF (my.jumping_mode == 1) { airborne_attack = 1; } ELSE { airborne_attack = 0; } my.movement_mode = 1; combo_continue = 0; } IF (mouse_right == 0 && mouse_right_press == 1) { mouse_right_press = 0; } /////////////// IF (mouse_right == 1 && mouse_right_press == 0) { IF (player_lock_on == 0) { c_scan(player.x,player.pan,vector(360,180,250),scan_ents | scan_limit | ignore_me); IF (you != null) { IF (you.entity_type == 2) { //make sure you've scanned an enemy player_lock_on = 1; target_enemy = you; } } } ELSE { player_lock_on = 0; target_enemy = null; } mouse_right_press = 1; } } IF (my.movement_mode == 1) { IF (my.jumping_mode != 10) { my.jumping_mode = 0; } ELSE { IF (my.animate >= 60 && my.animblend >= stand) { my.jumping_mode = 0; } } IF (mouse_left == 0 && mouse_left_press == 1) { mouse_left_press = 0; } IF (mouse_left == 1 && mouse_left_press == 0 && my.animate >= 30 && combo_continue == 0) { mouse_left_press = 1; combo_continue = 1; } } IF (my.movement_mode == 2) { my.jumping_mode = 0; IF (mouse_left == 0 && mouse_left_press == 1) { mouse_left_press = 0; } IF (mouse_left == 1 && mouse_left_press == 0 && my.animate >= 30 && combo_continue == 0) { mouse_left_press = 1; combo_continue = 1; } } }
FUNCTION handle_gravity() { var friction = 0.7; result = c_trace(vector(my.x,my.y,my.z-5),vector(my.x,my.y,my.z - 1000),use_box | ignore_me | ignore_passable); IF (result > 10) { IF (my.jumping_mode == 2) { IF (result > 120) { my.animate = 60; 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.animblend >= stand && my.animblend != jump && my.animblend != fall) { my.jumping_mode = 3; my.blendframe = fall; my.animate2 = 0; my.animblend = blend; } } my.force_z -= my.gravity * time; IF (my.movement_mode == 2) { my.force_z = 0; } } ELSE { IF (my.jumping_mode == 0) { my.force_z = -0.1 * result; IF (key_space == 0 && space_press == 1) { space_press = 0; } IF (key_space == 1 && space_press == 0 && my.movement_mode == 0 && my.animblend >= stand && my.animblend != jump && my.animblend != fall) { space_press = 1; my.jumping_mode = 1; my.force_z = 20; //25 my.blendframe = jump; my.animate2 = 0; my.animblend = blend; } IF (my.jumping_mode == 2 || my.jumping_mode == 3) { my.jumping_mode = 0; } } } if(result >= 0 && result <= 10 && my.jumping_mode != 1) { my.z -= result; my.velocity_z = 0; my.force_z = 0; } my.velocity_z = time_step * my.force_z + max(1-time_step * friction,0) * my.velocity_z; my.move_z = my.velocity_z * time; }
________________________________________________________________________________
This is what i have i cant see why does the collision wont work right. Can anyone please check it? Thanks
|
|
|
Re: Game
[Re: Mythran]
#174433
01/01/08 23:32
01/01/08 23:32
|
Joined: Sep 2003
Posts: 5,900 Bielefeld, Germany
Pappenheimer
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
|
The difficulty is to recognize all the details that relate to the problem. Try to concentrate on one of the issues only, and describe the circumstances as precisely as possible. (Nevertheless, your level is a big help to understand the problems.) And, better ask this in the forum "Starting with Gamestudio". You might get more answers there.
Just as an example: the "aabb" works only in A6 and in the professional version of A7, in case I understood what I read in the manual. Check the manual, compare the given explanations with the given lines in the script. Make a single change in the script, start the level, see what happens, etc.
----------
Another important thing: there are different collisions: the 'collisions' with the ground and the models under the player is handled by the trace or c_trace function. 'Collisions' where you run against a wall or another entity are part of the move or ent_move or c_move instructions. It depends on the flags set in that instructions. Then, the collision depends on which flag of a model is set, for instance: polygon or passable and such...
|
|
|
|