@@popadom4529 first, try to get the position of the mouse with get_global_mouse_position(). Then, store it in a Vector2 variable. After that, use the function var lookingAwayFrom = Vector2(get_global_mouse_position()) var lookingAt = -lookingAwayFrom func _process(delta): look_at(lookingAt)
I have been looking specifically for this for a while, forgot how to make weapons systems "look" at the mouse which might not be where the player is moving, this should help solve that problem. :D
Its crazy how this is and if you compare it to the same code in Unity, the godot version is sooo simple compared to unity version (well look at mouse code at least!)
So here's a question, I got a scene working fine where I have a sprite looking at the mouse, but now I've instanced that scene onto a player scene three times, and now the sprite that was instanced is not looking at the mouse, I'm guessing it has something to do with only the scene being played having an active _process function? If I wanted to have multiple instances of say, a turret that are attached to the player, is it possible setting up a script or something on the original scene that then works when you instance it onto the player?
i have a sprite of a bow and i want it to look at the mouse but it never looks right: the mouse can be somewhere and the bow will be pointing elsewhere(also my game is a platformer). please help me fix it
How can I get in an if statment that under a certain angle(when the mouse Is pointing uowards, so at the back of my player) the line has to be invisibile?
Me over here thinking you need to use schrodinger's equation to find the superpostion of the mouse then use entropy to calculate the total efficiency of the keyboard before dividing it by 0: This guy writing 2 lines of code:
How do I change the position the sprite is facing? For example a rocket ship would be facing up when I import the asset. Do I need to import it sideways or add a rotate 90° method somewhere so that the top is facing the mouse and not the right side. What is best practice here?
Assuming you'd like the tip of your rocket to face the mouse cursor you would make it drawn horizontally, with the tip facing right. I had the same exact issue, except with a sword. Here's an example with a sword: -|========> After flipping my sprite like that, as opposed to having it straight up, it works perfectly. (hope my really cool sword picture helped)
@@Zombozy Thanks, the sword picture is excellent! Yeah, I mean that seems to be the intuitive workaround. I'm just wondering because I couldn't find in the Godot docs anywhere that the right side is the face. Since that is apparently what's happening, it should be stated somewhere and also why to know how to handle this best. When I look at tile sets on itch.io for example things like spaceships would be facing up, not to the right. I can't imagine the best way to handle this is to flip every single asset 90 degrees before being able to use these.