0 votes

i making 2d game,it has gravity reverse,i use *= -1 to all gravity var,but function is_on_floor
dont reverse, how can i fix this

Godot version 3.4
in Engine by (99 points)

Did you change the 'Up' direction in move_and_slide? godot won't magically think something the ceiling is now the floor unless you tell it which way is up. Note there's also an is_on_ceiling.

thanks i forgot about moveandslide

1 Answer

+1 vote
Best answer

in your move and slide do move_and_slide(vel, Vector2.DOWN) vector2.DOWN is equal to (0,-1) which means the celling will now be classed as the floor

by (458 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.