Verán. llevo haciendo este sistema de Stamina desde hace un tiempo, es funcional en funcional en todo menos en una parte. Este solo baja pero no sube, llevo días intentando hacer que suba pero nada funciona y no se cual es el problema, También quiero hacer que no se empiece a restaurar hasta después que pase un tiempo.
Si alguien me puede ayudar se los agradecería

Video del problema
https://youtu.be/wAc2QYwSACI       

Te ayudaría pero no veo nada de código y el video esta en privado y no se puede ver, ponlo en oculto y se podrá ver solo por tu enlace

Cita de: Breloomgames71 en Febrero 11, 2022, 07:22:09 PM
Te ayudaría pero no veo nada de código y el video esta en privado y no se puede ver, ponlo en oculto y se podrá ver solo por tu enlace

No me habia dado cuenta de lo del video, ahi lo arregle

En vez de decir que si no es  StateP = StatePlayer.correr, podrias hacerlo mas sencillo ,
if stamina != staminamax{
stamina += 0.50;
}
Y te recomiendo (mi opinion)  no usar global en las variables.
Espero haberte ayudado con tu problema :)

#4 Febrero 11, 2022, 09:48:24 PM Ultima modificación: Febrero 15, 2022, 08:58:45 PM por Jeffrey Faper
tal vez esto le podria servir esta testeado en Game Maker 1.4

[gml]
//creo que me excedi con los comentarios asi que aqui  esta solo el codigo
//CREATE EVENT:
state = "IDLE";
runspd = 5;
walkspd = 2;
mainspd = walkspd;
hasStamina = 1;
staminaMax = 30;
staminaCount = staminaMax;

//STEP EVENT:
var keyRight = keyboard_check(vk_right);
var keyLeft  = keyboard_check(vk_left);
var keyUp    = keyboard_check(vk_up);
var keyDown  = keyboard_check(vk_down);
var keyRun   = keyboard_check(ord("E"));

    staminaCount = clamp(staminaCount,0,staminaMax);
    var moveX  = keyRight-keyLeft;
    var moveY  = keyDown-keyUp;
    var moving = point_direction(0,0,moveX,moveY);
   
    //ESTADO QUIETO
    if(state=="IDLE"){
       mainspd = 0;
       if(moveX!=0 && moveY!=0)
       ||(moveX!=0)||(moveY!=0){
          state = "MOVING";
          }
       }
    //ESTADO MOVIENDOSE
    if(state=="MOVING"){
       if(moveX!=0 && moveY!=0)
       ||(moveX!=0)||(moveY!=0){
          //CAMINAR
          mainspd = walkspd;
          //CORRER
          if(hasStamina && staminaCount>0 && keyRun){
             staminaCount -= 0.5;
             mainspd = runspd;
             }   
          }else{
                 state = "IDLE";
               }
       }
    //SI TIENE STAMINA
    if(hasStamina){
       //REGENERAR STAMINA SI EL JUGADOR PERMANECE QUIETO
       if(state=="IDLE" && staminaCount<staminaMax){
          staminaCount += 0.1;
          }
       //NO TENENMOS STAMINA
       if(staminaCount<=0){
          hasStamina = 0;
          }
    }
    //SI NO TIENE STAMINA
    if(!hasStamina){
       //REGENERAMOS NUESTRA STAMINA
       if(staminaCount<staminaMax){
          staminaCount += 0.1;
          }else{
                staminaCount = staminaMax;
                hasStamina = 1;
               }
       }
       
    direction = moving;
    speed = mainspd;

//DRAW EVENT o DRAW_GUI EVENT-----------------------------------------------------------------------------------------------------------------------------------------
//DIBUJAR MEDIDOR DE STAMINA
   draw_circular_bar(96,96,staminaCount,staminaMax,c_red,32,0.8,12);
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

//CREAMOS UN SCRIPT PARA DIBUJAR NUESTRO MEDIDOR DE STAMINA CIRCULAR..COPIAR Y PEGAR EN UN SCRIPT
///draw_circular_bar(x ,y ,valor_actual, valor_maximo, color, radio, transparencia, ancho)
if (argument2 > 0) { // no point even running if there is nothing to display (also stops /0
    var i, len, tx, ty, val;
   
    var numberofsections = 60 // there is no draw_get_circle_precision() else I would use that here
    var sizeofsection = 360/numberofsections
   
    val = (argument2/argument3) * numberofsections
   
    if (val > 1) { // HTML5 version doesnt like triangle with only 2 sides
   
        piesurface = surface_create(argument5*2,argument5*2)
           
        draw_set_colour(argument4);
        draw_set_alpha(argument6);
       
        surface_set_target(piesurface)
       
        draw_clear_alpha(c_blue,0.7)
        draw_clear_alpha(c_black,0)
       
        draw_primitive_begin(pr_trianglefan);
        draw_vertex(argument5, argument5);
       
        for(i=0; i<=val; i++) {
            len = (i*sizeofsection)+90; // the 90 here is the starting angle
            tx = lengthdir_x(argument5, len);
            ty = lengthdir_y(argument5, len);
            draw_vertex(argument5+tx, argument5+ty);
        }
       
        draw_primitive_end();
       
        draw_set_alpha(1);
       
        draw_set_blend_mode(bm_subtract)
        draw_set_colour(c_black)
        draw_circle(argument5-1, argument5-1,argument5-argument7,false)
        draw_set_blend_mode(bm_normal)

        surface_reset_target()
     
        draw_surface(piesurface,argument0-argument5, argument1-argument5)
       
        surface_free(piesurface)
       
    }
   
}

[/gml]