Air Dash

0 favourites
  • 6 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • I'm trying to develop an air dash in a platformer where the player dashes in the direction of "angle(Player.X, Player.Y, Mouse.X, Mouse.Y)". I've set up an instance variable called DashAngle and use the Move 20 pixels at DashAngle.

    My problem with the code is that no matter what I do, you can "dash" through solid objects. I've tried instead of "Move 20 pixels at DashAngle" to disable Platform on the player and enable the Bullet behavior instead, and that also gets the same issue.

    To fix this, I've input a line that basically states if you dash into a solid, cancel the dash. This works fine - but it seems slightly strange if you're dashing UP to a spot. If you hit the side of the solid, you stop dashing altogether and fall back down. So my actual question is:

    Is there a way to utilize an air dash with solids being involved (ie. pushing towards the solid at the angle specified instead of going THROUGH it)

    In case none of this made any sense, here's my code:

    <img src="" border="0" />

    Any help would be greatly appreciated.

  • I knew all I'd have to do was post it to figure it out :).

    For those who were curious, instead of ignoring platform, I just set gravity to 0. With a couple other small "on collision with FloorOb" adjustments, I got it working perfectly.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ome6a1717 Can you post the updated version? I am working on a game that has a similar movement, I just haven't gotten to that part of my logic yet... this may give me a good head start...

  • BluePhaze Sure - here's what I came up with.

    <img src="" border="0" />

    The only thing this does not do (which I'm currently working on) is after an air dash, it doesn't push the player a little in the direction you dashed it (it kind of just stops the dash and drops you vertically)

    I know it's something with Vector's, but I don't understand them.

    Hope this helps!

  • Nice, Thank You! On a side note, you may want to move the set gravity to 0 event up one level so it fires off on the is Dashing event. That way it is not setting it every tick. Since gravity is already set above, it won't change back till the is NOT dashing event. Not that it hurts, but any time I can do less checks every tick I do it. I doubt one extra call every tick really hurts performance, but it is a good practice to do as few checks as possible every tick as in the long run the more you have the more of a dent they put in your overhead processing.

  • BluePhaze No problem. Actually - you're right. However, I believe a "boolean = true/false" condition checks every tick regardless (I tried moved everything up and nothing changed).

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