This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes


I always got thar error message about the 'position' variable in this code:
var mousex=getglobalmouseposition().x
var mousey=get
for j in cards:
if j==null:
elif mousex>j.position.x and mousex<j.position.x+cardwidth and mousey>j.position.y and mousey<j.position.y+cardheight:
The if j==null: isn't working or what???
Cards is an array in my game thar contains instances of a card node.

Godot version 3.3 Stable Official Win64
in Engine by (52 points)

1 Answer

0 votes
var x = null
if x == null:
    print('prediction 1: x is null')
if typeof(x) == TYPE_NIL:
    print('prediction 2: x is null')
print(typeof(x), ' == ', TYPE_NIL)


prediction 1: x is null
prediction 2: x is null
0 == 0

both, typeof with its variant types and null check look valid.

maybe you can add code tags to your questions, maybe there is an intendation error which could explain the not working continue

by (38 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.