How do I Reset double jump?

  • I know i can do it manually using a variable, but thats atleast 5 extra lines.

    I like my programs to be as simple as possible, so im wondering if theres a way to say "reset the double jump""?

    I want my players to be able to be jumping up a wall, and when they hop of to have their double jumps reset, does anybody know if this is possible?

    Thanks in advance

    -Blank.

  • It's too bad the platform behavior did not include an action to do that. I've checked out the runtime file for the behavior and it's a simple boolean that say if a particular instance has double jumped or not.

    You could use the Browser object to inject some javascript that would allow you to manually change that variable of your player instance. Here's the code :

    var behavior_insts = this.runtime.objectsByUid['" & Player.UID & "'].behavior_insts
    for(var i = 0; i < behavior_insts.length;i++){
        var inst = behavior_insts[i];
        if(inst instanceof cr.behaviors.Platform.prototype.Instance){
            inst.doubleJumped = false;
            break;
        }
    }[/code:22urzyj5]
    This won't work once minified though.
  • This won't work once minified though.

    Okay well thats definitely interesting, i might do it on the final build but until then i can do without, thanks alot

  • Maybe if Ashley notices, he'll find the time to add this to his ever-growing to-do list.

  • Maybe if Ashley notices, he'll find the time to add this to his ever-growing to-do list.

    I hope he does, it doesn't seem to be requested alot thou, but it seems like you would find it under the platformer movement section lel

  • Yes, it's a simple addition to the Platform behavior. An action to set the "doubleJumped" boolean manually. Modifying an official behavior is pointless, and creating a new one with additional functionalities isn't much better. Your best bet is hoping for Ashley to take notice of this thread and apply the modification "officially".

    Meanwhile, you could encapsulate your "Reset double jump" routine in a function, and use this function inside your code. It will make refactoring easier when (if?) the time comes.

  • Is this really necessary? You can effectively force another jump just by setting the vector Y to a negative value, so you can keep hopping away as much as you like...

  • Is this really necessary? You can effectively force another jump just by setting the vector Y to a negative value, so you can keep hopping away as much as you like...

    ut then that's another "jump" logic that you have to create.

    Makes me wonder, perhaps a "force jump (even when not on platform)" action would be more versatile ?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Makes me wonder, perhaps a "force jump (even when not on platform)" action would be more versatile ?

    That's exactly what the set vector Y action does. A jump is the same as "if on ground, set vector Y to negative jump strength".

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)