0 votes
func _process(delta):
  var areas = get_overlapping_areas()
  for area in areas:
    if area.name == "Sand":
        emit_signal("outofwater")

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

Godot version 3.2.1
in Engine by (47 points)

1 Answer

+2 votes

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

by (238 points)

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

saddly It Did not

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.

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":
   print("True")
else:
   print("False")

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

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.

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

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