Cant tell what is crashing my game

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

I am trying to make this top down shooter. and i keep getting this error that completely crashes the game (The line of code i think the error is coming from is bullet_instance.set_direction(direction_to_mouse) because it has a little green arrow next to it(i don’t know what that means)) but it could be something else. https://forum.godotengine.org/68630/how-to-disable-font-oversampling-warning
but the solution on there doent work for me

the line of code with the arrow https://cdn.discordapp.com/attachments/761966031945990167/781261865547464734/Capture.JPG

My little brother is making games. And throughout the entire process of creating the game and it, a lot of mistakes and problems arose.

MiltonVines | 2020-11-27 14:53

:bust_in_silhouette: Reply From: edesse

If I understood correctly, your variable direction_to_mouseis used to get the direction where the gun is aiming. If so, you should instead use the pre-built look_at() function that does all the job for you.

Here’s some help : How do i correctly implement the top down movement I want? - Archive - Godot Forum

Rewrinting your code with this should solve your problem.

What if that is already in the script? I tried to look for a reason why it was acting like this and it said: Invalid call. Nonexistant function ‘set_direction’ in base ‘Area2D’

Chidiisanerd | 2023-02-13 12:58

What if that is already in the script? I tried to look for a reason why it was acting like this and it said: Invalid call. Nonexistant function ‘set_direction’ in base ‘Area2D’

Chidiisanerd | 2023-02-13 12:58