ESCCamera

Extends: Camera2D

Description

Camera handling for Escoria scenes.

Members

Methods


register

func register(room: Variant) -> void

Register this camera with the object manager so it can be used before being made active as part of the current scene tree.

Parameters

Name

Type

Description

Required?

room

Variant

The room with which to register the camera

no

Returns

Returns nothing.


get_tween

func get_tween() -> Tween3

The camera’s tween instance.

Parameters

None.

Returns

Returns the camera’s tween instance. (Tween3)


set_limits

func set_limits(limits: ESCCameraLimits) -> void

Sets camera limits so it doesn’t go out of the scene.

Parameters

Name

Type

Description

Required?

limits

ESCCameraLimits

The limits to set

yes

Returns

Returns nothing.


set_drag_margin_enabled

func set_drag_margin_enabled(p_dm_h_enabled: Variant, p_dm_v_enabled: Variant) -> void

Enable or disable drag margins for the camera.

Parameters

Name

Type

Description

Required?

p_dm_h_enabled

Variant

Enable horizontal drag margin

yes

p_dm_v_enabled

Variant

Enable vertical drag margin

yes

Returns

Returns nothing.


set_target

func set_target(p_target: Variant, p_time: float) -> void

Set the target for the camera to move to.

Parameters

Name

Type

Description

Required?

p_target

Variant

Object to target

yes

p_time

float

Number of seconds for the camera to reach the target

no

Returns

Returns nothing.


set_camera_zoom

func set_camera_zoom(p_zoom_level: float, p_time: float) -> void

Set the camera zoom level.

Parameters

Name

Type

Description

Required?

p_zoom_level

float

Zoom level to set

yes

p_time

float

Number of seconds for the camera to reach the zoom level

yes

Returns

Returns nothing.


push

func push(p_target: Variant, p_time: float, p_type: int) -> void

Push the camera towards the target in terms of position and zoom level using a given transition type and time. See https://docs.godotengine.org/en/stable/classes/class_tween.html#enumerations

Parameters

Name

Type

Description

Required?

p_target

Variant

Target to push to

yes

p_time

float

Number of seconds for the transition to take

no

p_type

int

Tween transition type

no

Returns

Returns nothing.


shift

func shift(p_target: Vector2, p_time: float, p_type: int) -> void

Shift the camera by the given vector in a given time and using a specific Tween transition type. See https://docs.godotengine.org/en/stable/classes/class_tween.html#enumerations

Parameters

Name

Type

Description

Required?

p_target

Vector2

Vector to shift the camera by

yes

p_time

float

Number of seconds for the transition to take

yes

p_type

int

Tween transition type

yes

Returns

Returns nothing.


check_point_is_inside_viewport_limits

func check_point_is_inside_viewport_limits(point: Vector2) -> bool

Checks whether the given point is contained within the viewport’s limits. Note that this is different from the camera’s limits when using anchor mode DRAG_CENTER.

Parameters

Name

Type

Description

Required?

point

Vector2

Point to be tested against viewport limits.

yes

Returns

Returns a bool value. (bool)


get_current_valid_viewport_values_x

func get_current_valid_viewport_values_x() -> Array

The inclusive minimum and maximum values for the x-component of the current valid viewport. Mainly used in any logging messages related to same. the current valid viewport.

Parameters

None.

Returns

Returns the inclusive minimum and maximum values for the x-component of the current valid viewport. Mainly used in any logging messages related to same. the current valid viewport. (Array)


get_current_valid_viewport_values_y

func get_current_valid_viewport_values_y() -> Array

The inclusive minimum and maximum values for the y-component of the current valid viewport. Mainly used in any logging messages related to same. the current valid viewport.

Parameters

None.

Returns

Returns the inclusive minimum and maximum values for the y-component of the current valid viewport. Mainly used in any logging messages related to same. the current valid viewport. (Array)


get_camera_limit_rect

func get_camera_limit_rect() -> Rect2

The camera’s current limits as a Rect2. Mainly used in any logging messages related to same.

Parameters

None.

Returns

Returns the camera’s current limits as a Rect2. Mainly used in any logging messages related to same. (Rect2)


clamp_to_viewport_limits

func clamp_to_viewport_limits() -> void

Used when drag margins are enabled. Clamps the camera so it respects the viewport limits inside the camera limits.

Parameters

None.

Returns

Returns nothing.