Battle sequence moving too fast. What does "slow down" mean in javascript

Discussion in 'Learning Javascript' started by jjleroy, Mar 28, 2019.

  1. jjleroy

    jjleroy I love bananas Veteran

    Messages:
    129
    Likes Received:
    27
    Location:
    Germany
    First Language:
    German, English
    Primarily Uses:
    RMMV
    Good day dear RPGmakerfriends. I'm trying to make a cool RPG battle design namely the persona 5 battle design.
    However, as you can see, things are moving way too fast.



    I don't know about you but I think first of all, the enemy's HP Gauge should be visible longer. Unfortunately this can't be controlled by parameters in the plugin.

    Second, the new turn starts too soon and the menu immediately pops up again even though the HP gauge is still going down.

    Third, the "1 MORE!" animation is actually a common event activated by a switch, and does not stop the flow of the battle, but just runs parallel, which looks rushed and weird. Unfortunately it doesn't work if I set it to autoplay.

    Now I tried to add

    this._waitCount = 600;

    into various places in the plugins, but nothing happened.
    Now I wanted to ask. What would be the proper way to make the battle process slower?

    EDIT: So what I tried now is to set a timeout before the HP gauge disappears.
    But nothing happened. The HP gauge simply never disappeared...

    Code:
    //==============================
    // * Update Fade
    //==============================
    HPGaugeSprite.prototype.updateFade = function() {
        if (this._slideA) {this._slideX += 2};
      
         setTimeout(function() {
             this.opacity = 0;
         }, 1000);
              
    };
     
    Last edited: Mar 28, 2019
    #1
  2. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,658
    Likes Received:
    9,193
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    I'm not going to answer the first one, sincr I don't even know any details whatsoever about how your action sequences are built. Nevertheless, the code you provided would be quite easy:
    Code:
    setTimeout(function() {
             this.opacity = 0;
         }, 1000);
              
    will never do anything. setTimeout, setInterval and xhr.on events are context losing methods. Meaning that 'this' actually refers to the highest level, in other words Window, regardless of where you define it. You may have some luck with
    "var self = this;" and then refer to self.opacity instead of this.opacity, although in all honesty, I doubt it would work and that you'd have to call the gauges by variable names.
     
    #2

Share This Page