Posted By: JazzDude
stuck player - 03/15/10 05:10
There's something wrong with this section of my player code. The player gets stuck in the stand animation and won't respond to the mouse_right until he hits a certain pan position--not always the same one.
I've tried every collision trick in the manual and a few from AUM and the forum but can't solve the problem.
That isn't all the action, of course, but the rest of it --camera, gravity--seems to be working okay.
I've tried every collision trick in the manual and a few from AUM and the forum but can't solve the problem.
Code:
player = my; c_setminmax(me); vec_set(my.min_x,vector(-15,-15,-50)); vec_set(my.max_x,vector(15,15,50)); my.z = 60; while (1) { player.pan -= 5 * mouse_force.x * time_step; if(key_pressed(281)) //mouse right { ent_animate(my, "walk", walk_percentage, ANM_CYCLE); walk_percentage += 7 * time_step; walk_percentage %= 100; if (walk_percentage < 10) { sounded_once = 1; } if ((walk_percentage > 50) && (sounded_once == 1)) { sounded_once = 2; ent_playsound(my, step2_wav, 70); } if ((walk_percentage > 95) && (sounded_once == 2)) { sounded_once = 3; ent_playsound(my, step2_wav, 70); } c_move (my, temp.x, nullvector, IGNORE_PASSABLE | GLIDE ); temp.x = movement_speed * (mouse_right)*0.6 * time_step; } else { ent_animate(my, "stand", stand_percentage, ANM_CYCLE); stand_percentage += 5 * time_step; } wait(1); }
That isn't all the action, of course, but the rest of it --camera, gravity--seems to be working okay.