1 registered members (TipmyPip),
18,466
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
A new way of movement
#256926
03/19/09 15:24
03/19/09 15:24
|
Joined: Mar 2007
Posts: 34 Osasco
xandeck
OP
Newbie
|
OP
Newbie
Joined: Mar 2007
Posts: 34
Osasco
|
Hello all and George, Please, I made all my moves based on your movements codes from AUM (I took some of them and mixed). My character can walk, run, attack (sword base), jump, get hit and die. But I have 2 problems: I created a map where there are some puzzles where player needs to solve. There is a platform (a small block) where it keeps rotating into it pan angle. If I try to jump from where my player is to the platform (with a hugh hole in my front) my player just go down fast. To temporary solve, I decreased the time of fall during jump. To understand better, check this screenshot:  So, first question  : How can I make a good jump script that I can really jump from one place to other with a hole in front? Second problem: when my character is above the platform (and the platorm keeps rotating), my character does not rotate with it. See the screenshot:  For both problems I tried a few scripts, but so far I could not solve. I will keep trying, but a help would be good.  I made a search and found nothing about this. Thanks
XandeCK Lead Developer JogadorVIP.com
|
|
|
Re: A new way of movement
[Re: George]
#257085
03/20/09 12:51
03/20/09 12:51
|
Joined: Mar 2007
Posts: 34 Osasco
xandeck
OP
Newbie
|
OP
Newbie
Joined: Mar 2007
Posts: 34
Osasco
|
Hey George, I will keep improving the game level and the design  I made some tests, but no good result yet. Here is part of my player script: FIRST PROBLEM 
vec_set(temp.x, my.x);
temp.z -= 5000 * time_step;
ground_distance = c_trace(my.x, temp.x, IGNORE_PASSABLE | IGNORE_SPRITES | SCAN_TEXTURE);
if (hit.texname == "ROCK_03.bmp"){
set (mypanel, VISIBLE);
} else {
reset (mypanel, VISIBLE);
}
// JUMPING
if (key_space && jump_key == 0) {
jump_height = minv(120, jump_height + 12 * time_step);
if (jump_height == 120){
jump_height = maxv(120, jump_height - 10 * time_step);
jump_key = 1;
}
} else {
jump_height = maxv(0, jump_height - 10 * time_step);
if (jump_height == 0 && !key_space){
jump_key = 0;
}
}
if (jump_animation < 99 && jump_height > 0){
jump_animation += 4 * time_step;
ent_animate(my, "jump", jump_animation, ANM_CYCLE);
} else {
jump_animation = 0;
}
// NORMAL MOVES
if ((key_w + key_s) && key_shiftl) { //RUNNING
movement_speed.x = 20 * (key_w - key_s) * time_step;
movement_speed.y = 0;
if (jump_height < 1){
anim_percent += 11 * time_step;
ent_animate(my, "run", anim_percent, ANM_CYCLE);
if (step_sound < 1) {
ent_playsound (my, wav_passo_mato, 300);
step_sound = 55;
}
else {
step_sound -= 3;
}
}
} else {
if ((key_w + key_s) || (key_a + key_d)) { //WALKING FRON, BACK, SIDES
movement_speed.x = 3 * (key_w - key_s) * time_step;
movement_speed.y = 3 * (key_a - key_d) * time_step;
if (jump_height < 1) {
anim_percent += 6.5 * time_step;
ent_animate(my, "walk", anim_percent, ANM_CYCLE);
if (step_sound < 1) {
ent_playsound (my, wav_passo_mato, 300);
step_sound = 60;
}
else {
step_sound -= 2;
}
}
} else { //STAND
movement_speed.x = 0;
movement_speed.y = 0;
if (jump_height < 1) {
anim_percent += 2 * time_step;
ent_animate(my, "stand", anim_percent, ANM_CYCLE);
}
}
}
movement_speed.z = -(ground_distance - 28) + jump_height;
movement_speed.z = maxv(-25 * time_step, movement_speed.z);
c_move (my, movement_speed.x, nullvector, IGNORE_PASSABLE | GLIDE);
I tried editing the first temp.z -=5000, but no succeed. I also tried to change the movement_speed.z... I think this is the problem, in this part of script... but I cant figure out how change... If my player start to jump from beginning of mountain, his jump height will not be too much high, so he starts to fall sudenly. If the jump height is at max, then I can move the jump to forward and then its good (sorry my english). SECOND PROBLEM  I try to use the SCAN_TEXTURE now, buuutt... as you can see in the code above, I did that commands, but it returns an error saying that "Syntax error: CANT CONVERT EQ:POINT:ARRAY:LONG"... what I did wrong? If I let this line "if (hit.texname == "ROCK_03.bmp")" to this "if (hit.texname = "ROCK_03.bmp")" the script runs, but mypanel is always visible, so it is not working as expected. Thanks again 
Last edited by xandeck; 03/20/09 12:55.
XandeCK Lead Developer JogadorVIP.com
|
|
|
Re: A new way of movement
[Re: George]
#257442
03/23/09 11:39
03/23/09 11:39
|
Joined: Mar 2007
Posts: 34 Osasco
xandeck
OP
Newbie
|
OP
Newbie
Joined: Mar 2007
Posts: 34
Osasco
|
I will try this week George, thank you.
XandeCK Lead Developer JogadorVIP.com
|
|
|
Re: A new way of movement
[Re: xandeck]
#257788
03/25/09 14:38
03/25/09 14:38
|
Joined: Mar 2007
Posts: 34 Osasco
xandeck
OP
Newbie
|
OP
Newbie
Joined: Mar 2007
Posts: 34
Osasco
|
Hello again George, ok, I did lots of tests, none were good use. I'm almost changing my hole move script  I cant manage to create a good jump script. If the ground below the player doesnt change at all (about height), the jump works good. But if I try to jump from one mountain to other (with a hole in the middle) the player just go down suddenly (he does not reach all the jump height). I noticed that the problem is with the commands where it computes the distance of the player to the ground, because even if I jump above a rock, my player suddenly raises his jump height. Its like: my player is in pos.z = 50 when I jump my player raises to a height pos.z + 110, resulting in 160 of height. If I jump a rock (lets say it has 30 height), it computes the rock heights with the player height, so it becomes 190 instead of 160. Is that possible for you to help me create a good jump script that really works. If you dont know what I mean, create a simple level (just a place where player can walk) and put something that player need to jump and try to jump above and to next side of it. You will see that the player suddenly raises its height jump. I will try to change my jump scrit, but so far tests were no good. Thanks in advance. EDIT: look the image below to try understand better what I say 
Last edited by xandeck; 03/25/09 14:46.
XandeCK Lead Developer JogadorVIP.com
|
|
|
Re: A new way of movement
[Re: xandeck]
#257831
03/25/09 19:36
03/25/09 19:36
|
Joined: Mar 2007
Posts: 34 Osasco
xandeck
OP
Newbie
|
OP
Newbie
Joined: Mar 2007
Posts: 34
Osasco
|
Ok, here I am again, this time, I think I got a solution (at last).  I changed my script of jumping and I put "IGNORE_MAPS" to it will ignore my map entities that I use to rotate and then the player does not go up suddenly. And I make some changes to make the jump smoothly (the player raises his height and velocity X+5 and when it is reaching the max height, X*-1*time_step, something like that).
XandeCK Lead Developer JogadorVIP.com
|
|
|
Re: A new way of movement
[Re: George]
#258832
04/02/09 11:39
04/02/09 11:39
|
Joined: Mar 2007
Posts: 34 Osasco
xandeck
OP
Newbie
|
OP
Newbie
Joined: Mar 2007
Posts: 34
Osasco
|
Hey George, just answering what you said above... that command with str_cmpi did not work, it crashs my application in a function that I did... and I dont have a clue why  I'm trying another ways around.
XandeCK Lead Developer JogadorVIP.com
|
|
|
Re: A new way of movement
[Re: xandeck]
#258836
04/02/09 12:03
04/02/09 12:03
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
try if((str_cmpi(_str("ROCK_03.bmp"), hit.texname)) instead.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
|