0 Favourites

[BEHAVIOR] Sonic Physics

  • Something along the lines of these events should get the effect you're after:

    The second condition makes it so that you'll only get the effect of the spring if you hit it from above, but you can remove it if you want to be able to walk into a spring from the side.

  • hey Im making a sonic fan game with this behavior

    so do you know how to make tails flight?

  • See the post above yours. You need to set the character's Vector Y to a negative value, although I'd recommend something closer to the jump strength than -1000. The conditions would probably be either "Is Falling" or "Is not on ground" and "Pressed <Jump Key>" instead of the collision condition in PixelMonkey's example.

  • TL22

    can you make a screenshot of it,please?

  • Something along the lines of these events should get the effect you're after:

    The second condition makes it so that you'll only get the effect of the spring if you hit it from above, but you can remove it if you want to be able to walk into a spring from the side.

    The only difference is you change the conditions to be "Player not on ground" and "Pressed jump", and maybe the Vector Y value (-1000 is a pretty mighty jump strength). You're going to have to fine tune it yourself depending upon what you have set up in your game. The idea is that you set the Player's Y vector to be negative in order to send them upward, in your case the press of the jump button while in the air. I'd imagine you'd also want to add in a variable to keep track of how long the Player has been in the air, discontinuing flight after certain number of button presses or time. I'd recommend looking at the various double jump tutorials that are littered around the How Do I? sub forum and Tutorials section of the Scirra site to get a better grasp of how to do it.

  • hey PixelMonkey,can you give me a copy of the sonic physics behavior but instead of the jumo button being the up arrow can be the the letter z from the keyboard?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • XtremeBlueTronic

    You can do this by using the "Simulate Control" action.

  • PixelMonkey but the problem with the simulate control is when you hold the key with the simulate control, the character keep jumping instead of stopping

  • XtremeBlueTronic

    Right, I see what you mean. Definitely a bug, but I'm not really sure how specifically I broke it, and with the mess that the code is in I don't really have the time to dive in and try to fix it, sorry.

  • PixelMonkey but the problem with the simulate control is when you hold the key with the simulate control, the character keep jumping instead of stopping

    I use a workaround myself involving custom controls. I have an <Input>Pressed boolean that turns false at the end of each tick after all other events have run in that tick (so it only registers true once) and an <Input>Held variable that adds 1*dt to itself depending upon how long the control is held. Then I use the "on floor" and "is jumping" conditionals of the Sonic Physics in the Player object for further control.

    Works really well, not a whole ton of set up.

    This behavior is really great, but if you want to use it you're going to have to find some creative workarounds, and possibly modify the behavior's runtime javascript to get it to work how you want.

  • TL22

    do you have the download of your <Input>Pressed boolean plugin,or it is pure coding in construct 2

  • TL22

    do you have the download of your <Input>Pressed boolean plugin,or it is pure coding in construct 2

    A boolean is just a variable.

    In C2, the only available boolean is via an Instance variable.

  • TL22

    do you have the download of your <Input>Pressed boolean plugin,or it is pure coding in construct 2

    I use a plugin called Global Variables. You can find it in the addons subforum, I think under completed. As Zenox just said though, a boolean is just a variable. Specifically a variable that only has a true/false or on/off state, effectively 0 and 1. You can achieve the same effect with "If JumpPressed = 1". I like the Global Variables plugin a lot though because it helps me keep things organized with larger projects.

  • Can you consider porting your behavior to Construct 3? I really want to use it!

  • I have discovered a bug that makes my game unplayable, when you have an object that has had the platform behaviour attached to it, if you then take that away and replace it with the sonicphysics behaviour, the game will crash upon launching, i really hope you can fix this.

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