How do i make my Camera2D area bigger?

Godot Version

Godot 4.0.2 sable

Question

I’m building an RPG game in Godot and I want to make the camera using Camera2D node. The cameras going to zero in one the player character. But the problem I have is when the player node loads in a map the area that corresponds to the camera is too small. The player can’t walk to far on the map.

What @fshroomsf said. Code-wise, this will smoothly zoom in/out, change settings as you like:

Let’s say your default zoom is:

var default_zoom := Vector2(0.6, 0.6)
var zoomed_in := Vector2(1,1)
var zoom_in_speed_sec := 0.8
var zoom_out_speed_sec := 0.69

@onready var camera: Camera2D = $Player/Camera2D

Zoom in:

	var tween = get_tree().create_tween()
	tween.tween_property(camera, "zoom", zoomed_in, zoom_in_speed_sec)

Zoom out:

	var tween = get_tree().create_tween()
	tween.tween_property(camera, "zoom", default_zoom, zoom_out_speed_sec)
2 Likes

Thank you

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.