This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote

hey, I ´ve started making a game(2D) and its ... kind of strategie, so I want to make a camera, which does not have a character, just to move by a pressed key.
Is it possible to do it without an object, that is binded to the camera?

in Engine by (31 points)

3 Answers

0 votes

It depends on your setup. For this the camera would have to be separate from the player and check if a player exists using get_nodes_in_group() or have the player tell the camera script when it is following it and use a bool to toggle the cameras free movement.

by (3,259 points)
+1 vote

The Camera2D object is a child of Node2D, meaning it can be moved based on it's transform. Very similar to how the character on the Your first game tutorial in the docs.

by (572 points)

This. The camera can also listen to events and do some actions based on inputs, so you'd just add the player script to the camera instead.

+1 vote

I was working on top down rpg recently with a free camera as well, and I found it to be usefull to make the camera a child of a hidden kinematic body. It should be still possible to do it without the kinematicbody but this makes it alot easier to avoid the camera going into places it's not supposed to.

by (307 points)

That is one different way to do it, but i guess it would work. But by default you just clamp the camera to a min/max X and Y coordinates and be done with it. Of course the assumption is that your map/camera limits is a rectagle.

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.