Air Dash

Get help using Construct 2

Post » Sun Jul 14, 2013 5:45 am

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:



Any help would be greatly appreciated.ome6a17172013-07-14 05:49:08
B
28
S
5
Posts: 475
Reputation: 2,533

Post » Sun Jul 14, 2013 5:58 am

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.
B
28
S
5
Posts: 475
Reputation: 2,533

Post » Sun Jul 14, 2013 7:18 am

@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...
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,538

Post » Sun Jul 14, 2013 7:27 am

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



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!
B
28
S
5
Posts: 475
Reputation: 2,533

Post » Sun Jul 14, 2013 7:34 am

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.
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,538

Post » Sun Jul 14, 2013 7:48 am

@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).
B
28
S
5
Posts: 475
Reputation: 2,533


Return to How do I....?

Who is online

Users browsing this forum: AllanR, rayray, RetroSpock, Turaco and 10 guests