How to get a 2D Camera follow a Sprite or a KinematicBody2D in a 2D Platform Game

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Scyro

So I’ve made a Project that is a 2D Platform Jumper. And I want the camera to follow my KinematicBody2D or Sprite (if possible both) and I researched for like an hour or two and I only saw solutions for Godot 2, but I’m using Godot 3 and I’m already used to its interface. Please Help

:bust_in_silhouette: Reply From: kidscancode

They are the same:

Attach a Camera2D as a child of your Player and set its “Current” property to “On.”

That’s all you need to get a working camera. After that you can experiment with drag margins and smoothing if you want to change up the camera’s movement.

Thanks for the answer. but of course since im new to this godot 3 script change How can i control my game work for mobile devices aka android and ios? I also researched about this question but they are all for godot 2. I just want my character to move left and right and jump i have my KinematicBody2D scripted for movement, but i want it to be reconfigured for a mobile device. then i don’t even know how to setup the gui overlay for left and right and the jump button. so i need help with that too.

Scyro | 2018-07-15 13:05

This is several different questions. All of them require a basic understanding of Godot and are answered in the Godot official docs: Godot Docs – 4.1 branch — Godot Engine (stable) documentation in English

Input: InputEvent
UI: Introduction to the UI System
Mobile: Exporting

You need to learn how Godot works before you try and find specific solutions, or you won’t understand what the answers mean. Follow the “Step by Step” section of the docs and you’ll learn how the engine works and how to do the things you’re trying to do.

This forum is for answering specific questions, not teaching you how to make a game. Please post each question separately so that it can be answered and also searched for in the future.

kidscancode | 2018-07-15 16:37