if (something) do not (something)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Superkrypet
func _process(delta):
  var areas = get_overlapping_areas()
  for area in areas:
	if area.name == "Sand":

i want to reverse it
So insted of this i want it to only to emit the signal when not touching the “sand”

:bust_in_silhouette: Reply From: abelgutierrez99

Have you tried if area.name != "Sand"?

Yes The problem with that is that it only sends signal when something not named sand enters. I want it to activate when player does Not Overlapp Something on a specific Layer. I Have tried signals as well as

var areas = !get_overlapping_areas()

But i havent tried

var areas != get_overlapping_areas()

so im gonna go do that know that i thought of it

Superkrypet | 2021-09-17 10:25

saddly It Did not

Superkrypet | 2021-09-17 10:30

I understand better now. I have an idea. Create a bool variable (outside the _process function) and every time your node collides or enter the area, change that variable, you may need to use not or if statements. In the _process or _physics_process make an if to check and make something depending on the variable. Not sure if it is the best solution, since you have to check the variable many times per second, but all depends on your project.

abelgutierrez99 | 2021-09-17 12:43

I Have an Island Made of Sand in the middle of the ocean. I want the Player to queue_free When it walks of the island OR one of the Platforms you are able to build in the Game. I have tried every solotion i can think of and i just can’t figure it out, for some reason when i Choose to print when im out of the water like this

if area.name == "Sand":

And i stand OUTSIDE of the island but still quite close for some reason it Prints out both True and False. Right now this engine makes now sense to me. There is not a single collision shape or object at that place and the collision for the player is intentionally smaller than the player. SOMEONE Please EXPLAIN

Superkrypet | 2021-09-18 15:01

Not sure what is happening. Maybe you can active the option to see collision shapes while running the game to see what is happening. Another idea is, instead of checking the sand, for example, create a collision shape that acts like a border, so when the player enters, something is done.

If this doesn’t solve your question, I advice you to make another question, because this is now taggeed “Answered” and recieve less visualizations.

Sorry if my solutions doesn’t work, I’m new to Godot, but not to programming.

abelgutierrez99 | 2021-09-19 13:04

Yes i will, And yes i have it did not help me. told you i tried everything. But thanks for helping anyways :slight_smile:

Superkrypet | 2021-09-20 06:40