Jump Forward

0 favourites
  • 10 posts
From the Asset Store
Jump on alphabets in the proper order and reach the sun!
  • Hi

    I'm making a platformer with the character using a sword. i'm trying to make the character leap forward (not jump) when a key is pressed (like him to stab the enemy).

    I want him to move a certain amount of pixels (whether he's running or not), very, very fast.

    So far messing with the max speed and acceleration had yielded no results. Neither have the VectorX. And the "Move" function teleports the player, instead of moving him.

    Thanks for any pointers.

  • I assume you're using the custom movement behavior on him? You could do the "Set CustomMovement Speed" and have it go back to normal after that runs for a half-second or however long.

  • I wasn't. Thanks for the tip. Will try it out ASAP.

  • Now the problem is that it allways jumps straight to the right, regardless of motion.

    My guess is that using the platform behavior and the customMovement behavior, I need to bridge information from one to the other, right? (or just use one, but that would be to much work).

  • ooh for some reason I was imagining the dash always going to the right. Could you more thoroughly describe the behavior you're looking for? Is it top-down, or a platformer

  • also if you link your .capx I might be able to help more. What I've done before when I needed to take control of movement like that was do the "SetCustomSpeed" twice, once for horizontal, and once for vertical, and set each with a formula.

  • Adagar, thanks for the responses.

    I'm trying to do an action platformer. My player is a ninja, and his attack is a swing of his sword. What I'm trying to do is for him to jump in the direction he's facing/running when the attack button is pressed.

    So when he's running forward, the attack will leap him forward 200 pixels in 0.2 seconds, inflicting damage to everything in his path.

    Later (When I figure how to implement the previous part), when he jumps, and hits the attack button, he will jump 200 pixels in 0.2 seconds in 45 or 90 degrees (inflicting damage to everything in his path).

    And later still, he will be able to do that in mid air (so he can dash in any angle including down; in a double-jump fashion.)

  • So far I tried this:

    (playerBox has both Platform and CustomMovement behavours)

    <img src="http://s11.postimage.org/5usx08sxf/code1.png" border="0" />

    s11.postimage.org/5usx08sxf/code1.png

    But the result is that player always jumps forward. And if it was running before the function is called, it stays moving (and I can't stop it) towards the right.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Using a wait might make everything else stop, I wonder how that would affect stuff like enemy movement...

    I'd recommend adding some more logic elements underneath there, I don't have the capx to send you back a screenshot with, but it'd be more like

    On PlayerForwardAttack- set lv_currentRunSpeed to PlayerBox.PlatformSpeed

       PlayerBox.velocity>=0- set CustomMovement Horizontal speed to gv_speedAttack

       PlayerBox.velocity<0- set CustomMovementHorizontal speed to -gv_speedAttack

       -Blank-- wait .2 seconds

                set customMovement Horizontal speed to 0

    Once your'e done with customMovement Horizontal, setting it back to zero should put platformer back into control

    Another thing you could do is give the player character a variable that has his current state stored. You'd set it when he turns left, or jumps, or what have you, and check that state when deciding what to set the customMovement to. For that custommovement speed, use either horizontal or vertical, I don't know what overall is supposed to be for.

  • Thanks. Settting customMovement Horizontal back to zero did the trick.

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