+1 vote

I want to do a command saying:

if player is touching a wall AND NOT touching a ground, do "this"

I know that is not how GDscript looks like but that's the jist of that the command I want to tell. So how do you those kind of statements?

in Engine by (83 points)

1 Answer

+3 votes

Its the same as C like languages.

&& = AND
! is NOT

if touching_wall(player) && !touching_ground(player):
do this

See Operators here:
https://godot.readthedocs.io/en/stable/learning/scripting/gdscript/gdscript_basics.html

I just noticed you can use 'and' instead of '&&' and 'not' instead of '!'. Cool!

by (251 points)
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.