How can I make Camera2D larger?

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

The fist thing that came to my mind is:

var zo = Vector2(2,2)
get_owner().get_node("Player/Camera2D").zoom(zo)
:bust_in_silhouette: Reply From: Zylann

There are several ways:

  1. Resizing your game window

Depending on which stretch mode you selected in your project settings, this will enlarge the area your camera can see.
See Multiple resolutions — Godot Engine (3.0) documentation in English

  1. Changing camera zoom

This is indeed a good solution which is independent of window resolution. Zoom will scale the area the camera can see, and can be used to make the game look pixelated without the need to resize everything. See Camera2D — Godot Engine (3.0) documentation in English

  1. Using a CanvasLayer

This is useful for making a GUI on top of your game that doesn’t scroll with the camera of the world. This node has a scale property and will affect its children a bit like camera zoom. See CanvasLayer — Godot Engine (3.0) documentation in English

and how can i script the second option?

fisox.zero | 2018-06-10 06:37

You can either set the zoom in the inspector, or you can do it by script:

# Zoom in by a factor of 2
get_node("Camera").zoom = Vector2(0.5, 0.5)

Zylann | 2018-06-11 01:16