0 votes

Hi, I'm looking for help in implementing a top down shooter camera like Enter the Gungeon or Synthetik. That is one that favors the direction of the mouse. The camera moves out towards the mouse but not all the way. I'm having some trouble conceptualizing what is needed to get this done yet alone carrying it out. Any help would be much appreciated.

in Engine by (56 points)

There are a couple things that need to be done.

First, your script will need to pull the window size, so it knows just how much your camera is showing.

Second, you need to define the max distance the camera can be from the player. This should be defined using the screen size as a variable, so that it works the same on different resolutions.

Third, you need to write a script to move the camera based on the position of your mouse. If your mouse is in the middle of the screen, no movement. If the mouse is at the edge of your screen, the camera moves to its max allowed distance. If the mouse is halfway to the edge, camera moves 50% of the way to its max, etc.

You could also consider including a deadzone around the edge of your screen, so that you don't need to move your mouse to the very edge of the screen to trigger 100% camera motion.

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 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.