mouse entered help with if statements

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DoGot

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

if mouse_entered:
x = true
else:
x = false

GDScript: Ternary operator (a if cond else b)
https://forum.godotengine.org/5803/one-line-if-statements

rakkarage | 2020-07-23 01:59

:bust_in_silhouette: Reply From: jgodfrey

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 that i mean the inbuilt function that returns true on mouse enter:

func on_Area2D_mouse_entered_():

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?

DoGot | 2020-07-23 19:01