0 votes

Hello, I am looking at a GDscript code and I see that it is possible to check directly in a dictionary if it is true or false as I show in this code.

var intercepto = espacio.intersect_ray(origen, destino, [], 1)
        print(intercepto)
        if intercepto: #I use a condition to check a dictionary
            var personaje = get_parent().get_node("Personaje")

However if I do this in godot c # it doesn't work

intercepto = espacio.IntersectRay(origen,destino,new Godot.Collections.Array{}, 1);

        if(intercepto)//no work
        {

        }

I was seeing in Godot c # that to do the check you have to see if that key exists in the dictionary,

        intercepto = espacio.IntersectRay(origen,destino,new Godot.Collections.Array{}, 1);

        if(intercepto.Contains("position"))//if the dictionary has that key
        {
        }

The question I have is:
-Godot engine GDscript when placed in the condition the dictionary automatically checks the keys?

-Is the interpretation with c # correct?

API GODOT ENGINE GDSCRIPT

API GODOT ENGINE C#

images
https://drive.google.com/open?id=1r_DvfKfeIr5aqR94HmEJgBRIdDS2QYMR
https://drive.google.com/open?id=1gEzJ5Fj-mJfldps4DFQiuUORTd9U95KO
https://drive.google.com/open?id=1zcPi23QAw7XGcypEJKIknX78535NK5pr

in Engine by (25 points)
edited by

Please log in or register to answer this question.

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.