+2 votes

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 bulletinstance.setdirection(directiontomouse) because it has a little green arrow next to it(i don't know what that means)) but it could be something else. https://godotengine.org/qa/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

in Engine by (14 points)

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

1 Answer

–1 vote

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 : https://godotengine.org/qa/82268/how-do-i-correctly-implement-the-top-down-movement-i-want

Rewrinting your code with this should solve your problem.

by (65 points)

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'

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'

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.