0 votes

I don't know how to word this in one sentence but I want to code something like this

if mouse_entered:
x = true
x = false

in Engine by (24 points)

GDScript: Ternary operator (a if cond else b)

1 Answer

+1 vote

I'm not sure what mouse_entered is. Assuming it's just a boolean value, then this is the cleanest way...

x = mouse_entered
by (10,884 points)

by that i mean the inbuilt function that returns true on mouse enter:

func onArea2Dmouseentered():

in here I want to have the variable have a default value of false and otherwise have a true state

Is there anyway to do that?

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 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 webmaster@godotengine.org with your username.