How do I change gravity to go either Up, Down, Left or Right?

Before proceeding, please use the forum search feature at the top of the page to check if your question has already been answered.

How do I…

To make gravity go down i know you can add the platformer behavior and
to make it go up i know that you can just set the gravity and jump height to a negative value
(i think but this shouldnt be to hard)
but how do i make the gravity go left and right?

Here’s a previous post that might help. This was from 2020 and they say setting gravity to negative with the platformer behavior isn’t a very good idea. Unless they updated it recently for such.
My takeaway from that is to work with force angle.
Like, if the player gravity variable is 3oclock : add force angle 270 degrees 800px. Something like that. So you can even get diagonal directions as well.
You might want to look into physics engine as well as suggested in this same post.

if you could, how would i do this like an example

Alright, here you go. This one uses the Physics 2.0 behaviour.

so it works (yippee) but i do need help with detecting if the char is on the floor (with the skewed gravity n all)

I have to admit, I have rather limited experience with physics behaviour. But if I were to do it manually, here’s how I think it might go:

Set an event to pick the nearest floor object to the player’s position.
Set player’s orientation using angle to object, rounded off to the nearest 90 degree increment (assuming the floor object is rectangular).
Apply gravity accordingly while jump is not being pressed.
With the physics behaviour, the floor object i believe is to be set as a static body type so that should handle the collision.
And yeah, theoretically, I think that should do it.