Godot Version
Godot 4.4.1
Question
I'm making a doctor who fangame where the player can use sonic screwdriver to interact with objects, i used a tutorial and managed to make so that the area2D as a hitbox will appear during the animation and if it touches something in a group of "mechanic" it will use the func breaking(). But it doesn't work for me even as a test. Here's the code i used for the player character:
func _on_area_2d_area_entered(area: Area2D) → void:
if area.is_in_group(“Mechanic”):
if area.has_variable(“SonicPitch_req”) and SonicPitch == area.SonicPitch_req:
if area.has_method(“Breaking”):
area.Breaking()`
and here’s what i used for the staticobject2d that it needs to call
`extends StaticBody2D
var SonicPitch_req := 2 # Change this per object
func Breaking():
print(“Mechanism activated!”)
$CollisionShape2D.disabled = true
$Sprite2D.hide()
`
I would be glad if someone can help a starter developer, because even ChatGPT can’t help.