–1 vote

I'm making a TopDown game but when I put the Player scene in the World scene, two shots come out, one at the player and the other at point 0 of the scene. The world is a node.

Godot version 3.23(mono)
in Engine by (27 points)

Without seeing any code, my only assumption is that your if condition only checks to see whether the input event was a mouse button press. When you click the mouse you get two events: one where pressed = true (mouse down) and one where pressed = false (mouse up).

Post the code and I can give you a more definitive answer.

Also, you can try using global position.

if(Input && ContadorTiro == 0)
    {
        var Rotation = (GetGlobalMousePosition()- GlobalPosition).Angle();

        Bullet.Rotation = Rotation;
        Bullet.Position = Position;
        GetParent().AddChild(Bullet);

        ContadorTiro = TempoDeSaida;
    }
    else if(ContadorTiro > 0)
    {
        ContadorTiro -= 1;
    }

*Bullet is an instantiation of the scene
My problem is that when I use Position and GlobalPosition in a scene where I instantiate the Player, two Vector2 values ​​are returned. Carrying the projectile shoots from the two positions

My problem is that when I use Position and GlobalPosition in a scene where I instantiate the Player, two Vector2 values ​​are returned. Carrying the projectile shoots from the two positions. That is, it still doesn't work

Please log in or register to answer this question.

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 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 webmaster@godotengine.org with your username.