Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: ffffffffff on April 20, 2020, 07:33:11 AM

Title: making dash in 2d
Post by: ffffffffff on April 20, 2020, 07:33:11 AM
so i use playmaker to make a dash thing turn out fine until  the player can dash through wall   pls i need help i use translate
Title: Re: making dash in 2d
Post by: heavygunner on April 20, 2020, 11:31:57 AM
Did you added colliders?
Title: Re: making dash in 2d
Post by: djaydino on April 21, 2020, 03:51:17 AM
Hi.
Translate does not use physics.

Use set velocity (and have a rigidbody2d) or use raycasts and stop translation.
But with fast moving raycast might fail.
Title: Re: making dash in 2d
Post by: ffffffffff on April 22, 2020, 12:08:58 AM
i do like you said it work a bit but the player can only dash in 1 direction so how do i make the player to dash left and right
Title: Re: making dash in 2d
Post by: djaydino on April 22, 2020, 05:32:51 AM
Hi.
you can set a negative velocity as well

so 1st detect what direction the player is (depending on how you do this, scale/sprite flip/rotate)

then for the negative value you can set manual OR do a float operator and multiply by -1
Title: Re: making dash in 2d
Post by: ffffffffff on April 22, 2020, 11:59:20 AM
so which action should i use to  detect the player movement
Title: Re: making dash in 2d
Post by: djaydino on April 23, 2020, 07:34:48 AM
Hi
how are you moving the player?
and how are you flipping the player?

For example if you use scale, then get the x scale and check if greater or less than 0.
if you use rotation get the rotation and compare if 0 or not
if you use sprite flip then get that value and check the bool.
Title: Re: making dash in 2d
Post by: ffffffffff on April 26, 2020, 12:52:38 AM
I use scale but the point is i don't know which action to check .like set up a bool or add force,etc
Title: Re: making dash in 2d
Post by: djaydino on April 26, 2020, 09:23:04 AM
Hi.
Get Scale, Then Float compare

if less than 0 do force left/right
if greater than 0 do force in the other direction
Title: Re: making dash in 2d
Post by: ffffffffff on May 01, 2020, 10:13:15 PM
could you make an  example for me. i dont know how to use get scale
Title: Re: making dash in 2d
Post by: ffffffffff on May 02, 2020, 05:27:55 AM
so this is my FSM it dont work . am i miss order them. pls help
Title: Re: making dash in 2d (Solved )
Post by: ffffffffff on May 02, 2020, 10:18:11 AM
thank a lot .
Title: Re: making dash in 2d
Post by: ffffffffff on May 02, 2020, 11:44:03 AM
So far i made the dash work . But i can only dash in mid air .i want to dash while on the ground as well . What should I do.Again thank for helping me