Código
fscommand ("fullscreen", "true"); // Estadísticas: DKMarioMaxStamina = 1000; DKMarioMaxSpeed = 0.5; DKMaxStamina = 500; DKMaxSpeed = 0.7; // ///////////////////////////////////////////// // ////////////////// Most /////////////////// // ///////////////////////////////////////////// function FaceRight (id) { if (eval(id+".Facing") == -1) { set (id+".Facing", 1); eval(id)._xscale = 100; } } function FaceLeft (id) { if (eval(id+".Facing") == 1) { set (id+".Facing", -1); eval(id)._xscale = -100; } } // ///////////////////////////////////////////// // ///////////////// DKMario ///////////////// // ///////////////////////////////////////////// function ControlDKMario () { // Aumentar su Stamina si no está al máximo: if (Player.Stamina<DKMarioMaxStamina) { Player.Stamina++; } if (Key.isDown(39)) { // Si se presiona derecha: eval("RightWhen"+Player.Action)(); } else if (Key.isDown(37)) { // Izquierda: eval("LeftWhen"+Player.Action)(); } else { // Nada: eval("QuietWhen"+Player.Action)(); } Player.Turn = Player.Turn+Math.abs(Player.Speed)*0.6; if (Player.Turn>=10) { Player.Turn = Player.Turn-10; Player.Movie.play(); } } // When Quiet: function RightWhenQuiet () { StartToWalk(); WalkToRight(); } function LeftWhenQuiet () { StartToWalk(); WalkToLeft(); } // When Walking: function RightWhenWalking () { WalkToRight(); if (Player.hitTest(MetaDePlayer) == true) { Player.Meta = true; removeMovieClip(MetaDePlayer); } } function LeftWhenWalking () { WalkToLeft(); if (Player.Meta == true && Player.hitTest(AliadoDePlayer) == true) { gotoAndStop(4); } } function QuietWhenWalking () { Player.Action = "Quiet"; Player.Speed = 0; } // To whens: function StartToWalk () { Player.Action = "Walking"; Player.gotoAndStop(2); } function WalkToRight () { Player.Speed = (Player.Speed + DKMarioMaxSpeed)/2; Player._x = Player._x+Player.Speed; FaceRight("Player"); } function WalkToLeft () { Player.Speed = (Player.Speed - DKMarioMaxSpeed)/2; Player._x = Player._x+Player.Speed; FaceLeft("Player"); } // ///////////////////////////////////////////// // /////////////////// DK //////////////////// // ///////////////////////////////////////////// function IAActs () { if (IA.Stamina < IA.MaxStamina) { IA.Stamina++; } IA.Tic = Math.abs(IA.Speed)*0.3; IA.Speed = (IA.Speed + IA.MaxSpeed)/2; IA._x = IA._x+IA.Speed; IA.Turn = IA.Turn+IA.Tic; if (IA.Turn>=10) { IA.Turn = IA.Turn-10; IA._xscale = IA._xscale*-1; } }
Quiero agregarlo, o sea:
- Que el personaje al moverse pierda stamina.
- Cuando queda con 10 o menos, quede en estado de cansado, sin poder moverse, pero recupere stamina y vuelva a su estado normal cuando tenga 50 o más.
- Cuando queda quieto también recupere.
No parece difícil pero la animación de caminar se estaba ejecutando aunque el personaje está cansado, intentaba arreglar eso hasta que me lié:
Código
// ///////////////////////////////////////////// // ///////////////// DKMario ///////////////// // ///////////////////////////////////////////// function ControlDKMario () { // Aumentar su Stamina si no está al máximo: if (Key.isDown(39)) { // Si se presiona derecha: if (Player.Stamina > 50) { Player.Stamina--; eval("RightWhen"+Player.Action)(); } } else if (Key.isDown(37)) { // Izquierda: if (Player.Stamina > 50) { Player.Stamina--; eval("LeftWhen"+Player.Action)(); } } else { // Nada: eval("QuietWhen"+Player.Action)(); } Player.Turn = Player.Turn+Math.abs(Player.Speed)*0.6; if (Player.Turn>=10) { Player.Turn = Player.Turn-10; Player.Movie.play(); } } // When Quiet: function RightWhenQuiet () { StartToWalk(); WalkToRight(); } function LeftWhenQuiet () { StartToWalk(); WalkToLeft(); } function QuietWhenTired () { if (Player.Stamina < DKMarioMaxStamina) { Player.Stamina++; } } function QuietWhenQuiet () { if (Player.Stamina < DKMarioMaxStamina) { Player.Stamina++; } } // When Walking: function RightWhenWalking () { WalkToRight(); } function LeftWhenWalking () { WalkToLeft(); } function QuietWhenWalking () { Player.Action = "Quiet"; Player.Speed = 0; } // To whens: function StartToWalk () { Player.Action = "Walking"; Player.gotoAndStop(2); } function WalkToRight () { Player.Speed = (Player.Speed + DKMarioMaxSpeed)/2; Player._x = Player._x+Player.Speed; FaceRight("Player"); if (Player.hitTest(MetaDePlayer) == true) { Player.Meta = true; removeMovieClip(MetaDePlayer); } } function WalkToLeft () { Player.Speed = (Player.Speed - DKMarioMaxSpeed)/2; Player._x = Player._x+Player.Speed; FaceLeft("Player"); if (Player.Meta == true && Player.hitTest(AliadoDePlayer) == true) { gotoAndStop(4); } } function Tired () { Player.Action = "Tired"; Player.Speed = 0; }
Además la idea no me está resultando buena, no sé por qué.
Estaba poniendo que sólo puede moverse si tiene stamina 50 o más, pero entonces llega un punto en que se mueve un poquito (en teoría), ya no puede moverse, y se repite. Para que el descanso sea más largo supongo que lo soluciona lo que comenté con guiones, pero no suena realista que te puedas cansar mucho pero luego cuando estás un poco cansado no te puedas mover hasta quedar normal, no sé si me explico.
Puedes gastar energía hasta que sólo te queda 10. Pero entonces hasta que tengas 50 no puedes gastar. ¿Por qué antes sí? No tiene mucha lógica. Lo que se me ocurre ahora es que cuando tienes 50 si te mueves la energía te queda en 0 porque el organismo se enfoca en recuperarse, cierto sentido tiene ¿no?
Lo intentaré hacer más despacio a ver si me sale. Los leo.





Autor



En línea
