Platform character knockback

While designing a platformer game, I wanted the smoother movement of forces. The platformer plugin is internally complex. I have a more barbaric implemention that directly adjusts the X and Y positions because it is the only safe way to cooperate with the “Platform Character” behavior/plugin.

To be as english and non-technical as possible, in a collision check between an enemy character and the player character I want the ability to “bounce” smoothly in a small arc AWAY from the enemy. Attempts to use a Force directly only seem to confuse the plugin and trigger other unwanted code in my project. I have a Y=2000 killing line for falling off the platform that has triggered despite the collision happening around Y=768. I have seen bouncing across the platform as well as endlessly “floating” off upward in to the sky. As I can not see the internals of the plugin I assume this relates to the complex handling of many variables which take care of the smooth movement.

On a more technical note my work-around makes use of sign() to determine left or right as follows:

Change the position of Player += sign(Player.X() - Enemy.X()) * 80 (x axis), -= 50 (y axis)

It would be very helpful if the plugin exposed a “Set horizontal velocity” action.

I built a jump_pad that successfully works with the plugin by storing the current jump speed and simulating the jump keypress and then restoring the jump speed. For my request I can not seem to figure out a valid smooth-forces-based-arc-movement that cooperates with the behavior plugin.

Thank you for taking the time to try to help me. I was hoping your suggestion would offer me a better workaround because I had not tried to use “Instant” force. I figured it would provide a way to cooperate with the platform plugin.

Unfortunately regardless how I try to use any “Forces” most especially the “Stop the object” clearing all forces commands, the internals of Platform Character are extremely hostile to those changes. My previous symptoms still stand true along with a new one where using permanent force sent the player so fast toward the sky that the platformer camera no longer followed and all I could see was the sky.

This simple arc request has given me days of frustration. I caved and resorted to A.I. help but the AI can not even figure out this class of bug.

So I had a thought after posting that my original workaround to directly set position could be enhanced. Why not use that directly and create an arc using a bunch of position adjustments so that we are completely overriding the plugin entirely while not accidently meddling with its internal states. My math skills are not mastery level so I did ask AI for help with the request. I was given a solution that works.

I genuinely hope this helps someone who uses the platformer plugin and needs a working solution. While I no longer need the feature, I think it would be an awesome addition to the platform character plugin to help keep math usage at an easier basic level. Happy coding everyone! :smiling_face_with_sunglasses: