How to do smooth knockback for player

How do I make it so when a player collides with enemy, he gets a smooth knockback either left or right depending on whether he is horizontally flipped or not, that stops when he hits the ground?
I tried to do it with a tween but while he is in mid air he comes to a sudden stop, like the first image


I want it to be like the second image, where the player gets a sudden jump upwards and keeps moving in the opposite direction until he is on the ground

If you’re using the platformer behavior, the tween may be interfering with the it. Try disabling the behavior when the tween starts, then enable it once the tween is finished.

Also can you share a screenshot of the tween events?

Alright, here it is


I realize that it might be the X() + that makes it stop, but if I make it any higher it sends him flying, no idea what else to do, I just want it to be a slight knockback that keeps going until player is on a platform

Instead of simulating a jump, you can tween the Y position up and down. This gives more control over the movement of the knockback.

Something like this.

It does work for what it is but it’s the same as the effect in image 1 that I shared https://cdn.discordapp.com/attachments/576553475337486351/1269096888297197719/2024-08-03_03-57-22.mp4?ex=66aed214&is=66ad8094&hm=3d67bf416a1fd9741bf8dcbe06901e4a53d350fe7dfb777aa50083bc07329fb8&
Notice how the player gets knocked, comes to a sudden stop and then starts falling in a straight line? I don’t want that, I want him to keep moving (no falling in straight line) until he is on a platform, it doesn’t need to be tweens, just anything that achieves the effect of image 2

The example I shared works if the player is always on the same platform level.

But since this is not the case, you can keep your previous event with the simulate jump, but instead of tweening the X position you can add a permanent force (angle), 0 or 180 deg.

Then check if the player is on a platform → stop the object.

I tried this, and he only does the jump, whether it’s 0 or 180

The event I shared worked fine when I tried it. Make sure the ordering of the events is the same as the example.

Nvm, I noticed it works when I click twice, so I added a “wait 0.02 seconds” and put the action again, now it works, thank you