0 Favourites

How do I simulate diagonal jump?

  • Hi guys, this is my first topic here in the forum , but I have been 'playing' with C2 for about 2 weeks.

    My question is, How do I simulate control of jump, but not only in vertical ? I need something like in the normal platform behavior when up/left or up/right are pressed at same time.

    Resuming: When 'left' is pressed, the player goes to his left position, but jumping to there. The same for right button.

    I created a gif to illustrate what I want to do:

    http:// i.imgur.com/WVvhLMQ .gif (join the url, I'm new so I can't put URL's : p )

    A fter seeing this, someone can say "Just add a platform behavior to your

    player", but that is not my objective. Because I don't want the player walking on the platforms, just jumping to one platform to another, the jump movement to right/left its just a 'illusion' of control, the Player is fixed in a point on the platform he is. That's why I think I should work with simulate control, but I don't know how to do this.

    I don't know if I explained well, but this is my question hehe.

  • You can add the platform behavior, and then set the controls to NOT default. This way the only movements the player can do are the ones you make in your events.

    Now you can do this, add an instance variable to the player called "direction"

    When the player presses right set "direction" to 1, and when he presses left set "direction" to -1

    Player.direction = 1
        : Simulate move right
    Trigger once
        : Simulate jump[/code:3ai6stug]
    
    [code:3ai6stug]Player.direction = -1
        : Simulate move left
    Trigger once
        : Simulate jump[/code:3ai6stug]
    
    [code:3ai6stug]Player hits ground (a platform behavior condition)
        : Set Player.direction to 0[/code:3ai6stug]
    
    Then you can play around with the max speed, acceleration, gravity, etc to get the movement the way you want
  • Does this work as a starting point? Use the left and right arrows.

    I just made a little modification to the file, so if you downloaded it before you might want to try again.

  • This seems to work better

  • 7Soul

    You must be running the Beta C2 as I'm not able to open your file, so I'll take your word for it that your's works better.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • shirokuma Yes it's the latest beta. I used the platform behavior like I said in my previous comment. In your's the physics behavior was causing some unwanted movements, but I think if you stop rotation of the object it helps.

    And plus, physics don't interact well with other behaviors so you should avoid it when possible

  • Wow, thx guys, you're awesome.

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