0 votes

I need to do this because I want to have a shield in my game. Any help would be greatly appreciated.

Godot version 3.4.2
in Engine by (24 points)

1 Answer

+1 vote
Best answer

You can use monitoring property of Area2D or disabled property of its collision shape

by (8,097 points)
selected by

I’m sorry but, I don’t really know how to use this information properly. I’m relatively new to the engine and language.

func input(event):
       if input.is_action_pressed("shield_up"):
             $Area2D.monitoring = true
       elif input.is_action_just_released("shield_up")
             $Area2D.monitoring = false

So pressing input for "shieldup" activates Area, and releasing it deactivates the area
this is not syntax-perfect, but You should get the point. Instead of $Area2D.monitoring You can use $Area2D/CollisionShape.shape_disabled to true or false. There are many more options. Always read about nodes methods in editors built-in documentation

If You still don't get it, You definetely need to dig into some basic tutorials first

Thank you for your help. The documentation really helped too. :)

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.