i new to program and try to follow a Tutorial but i got this and i dont know how to fix it :v pls help

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

i new to program and try to follow a Tutorial but i got this and i dont know how to fix it :v pls help

the bug is: invalid call.nonexisten function “get_overlapping_area” in base “area2d”
here’s my code
func damage_loop():
if hitstun > 0:
hitstun -= 1
for area in $hitbox.get_overlapping_area():
var body = area.get_parent()
if hitstun == 0 and body.get(“DAMAGE”) != null and body.get(“TYPE”) != TYPE:
health -= body.get(“DAMAGE”)
hitstun = 10
knockdir = global_transform.origin - body.global_transform.origin

:bust_in_silhouette: Reply From: jgodfrey

Coding is an exercise in precision. You can’t just get “close” to the language requirements (GDSript in this case) and expect it to work.

For the specific problem, an Area2D doesn’t have a function named getoverlappingarea, just as the error states. If you look at the docs of Area2D, here:

… you’ll see that it does have a function named get_overlapping_areas, which is what I assume you want.

Likewise, I’d guess you want global_transform instead of globaltransform.

In general, make sure you type language references exactly as they’re documented.

It was just the missing “s” in the end. The underscores are just not displayed here, because they occurred outside of the code-tags, thus were interpreted as markup for italic text.

@mobede3: Make sure, your code samples are formatted properly next time. Do not just paste your code here, but select all of it afterwards and then click the Button with the two curly brackets “{ }” to format it as a code block. You can ensure everything looks right by looking at the Preview below the editor before posting.

njamster | 2020-02-07 16:30

Yah, if even a single character is off, nothing will work, that’s how it is no matter what you use to code.

Merlin1846 | 2020-02-08 04:21