# How to add a 2d dash ability

i’m going to start adding abilities to trigo run… so how would i add a dash ability… to where whatever direction you’re moving…

This is why there is a need for a no more than 3 consecutive replies rule.

I think you can use the particle system for this.

https://developer.playcanvas.com/en/user-manual/graphics/particles/

1 Like

well i dont really need a visual effect right now i want a dash ability script… sorry for the confusion

i need to know the function for this… as i explained in the post

I think you can just teleport the rigidbody in the forward direction a couple of times in a row. Another and easier option is to increase the movement force. How the player can activate the dash?

1 Like

so how im going to do it is when you travel to the different worlds… you get a different ability… to use the ability you press SHIFT and first im focusing on the first ability… and there really isnt any material on this… so i think if this gets solved it can really help the community since lots of games need a dash system

Personally,

I’d just calculate the final position when the ability is used (player forward vector * distanceToTravel) and teleport the player there. There are some problems you can encounter (going trough wall) but that can be easily managed by doing a raycast from player position and forward vector.

The “afterimages” that are shown in the example could be just made by combining two-three particles where you would use a burst particle effect and use a model (player) as a base and create the other effects on 2nd, 3rd particle. Just get the length of the start and end position, calculate it’s direction and place 5, 6, 10, 2000 afterimages in-between the start/end point by dividing the number of afterimages with the distance length and place them in a short setInterval().

Best of luck

1 Like