I was make my dash move by using tween obj but when I dash on walls it clip thought it how I can fix that
What kind of tween - a positional one? In that case, you need to check whether there’s a collision between the object and a wall, and stop the tween if there is a collision.
I try but it doesn’t work it just clip thought the wall very fastly
Can you provide a screen snip of the events that do this?
Yes, that won’t work because that collision check only happens once - the first time the z key is pressed.
You need to drag the collision check event to the left by one position to it’s at the same level as the key press events, so it looks like :
That’s not a problem
Well, @MrMen explained everything above. It won’t work because the collision is only checked when you first press the Z key. It also happens only once. So he suggested you to not keep the Stop tween event as a sub-event of the event that checks if the Z key is pressed. Just drag the Stop tween to the left to un-sub-eventify it (to not keep it as a sub-event, I didn’t know the word hehe). After you drag it, the event should look like this:
Picture from MrMen
Oh. You’ve tried my suggestion and it didn’t work?
Just to add some clarity here:
Tweens do not care about collision, because they’re completely separated from any behavior (such as platformer or platforms) logic other than the tweens. When you tween x or y, you’re telling the engine “tween the position of this sprite no matter what until it reaches the destination position”.
Because of this I normally do not recommend tweens for dashes, but if you must use tweens for dashes, MrMen’s solution for stopping the tween if in collision with a solid is the correct idea.
Well now not passing through the walls but now it’s stuck in the wall I try to negate key pressed on z but it keep dashing in the wall
Ok, so when you stop the tween, also separate the Player from the Solids (Player moves)