PopochiuMainCamera
Inherits: Camera2D
Description
Manages the main camera used by Popochiu for screen effects like shaking and zooming.
This camera follows the player character and can be manipulated to create visual effects during gameplay, such as screen shake for impacts or zoom for dramatic moments.
Properties
| Type | Name | Default |
|---|---|---|
| Variant | is_shaking | false |
Methods
| Return Type | Method |
|---|---|
| void | change_offset(offset = Vector2.ZERO) |
| void | change_zoom(target = Vector2.ONE, duration = 1.0) |
| Callable | queue_change_offset(offset = Vector2.ZERO) |
| Callable | queue_change_zoom(target = Vector2.ONE, duration = 1.0) |
| Callable | queue_shake(strength = 1.0, duration = 1.0) |
| Callable | queue_shake_bg(strength = 1.0, duration = 1.0) |
| void | restore_default_limits() |
| void | shake(strength = 1.0, duration = 1.0) |
| void | shake_bg(strength = 1.0, duration = 1.0) |
| void | stop_shake() |
Property Descriptions
is_shaking
var is_shaking = false
Method Descriptions
change_offset
func change_offset(offset = Vector2.ZERO) -> void
Changes the main camera's offset by offset pixels. Useful when zooming the camera.
change_zoom
func change_zoom(target = Vector2.ONE, duration = 1.0) -> void
Changes the camera zoom. If target is greater than Vector2(1, 1), the
camera will zoom out; smaller values will make it zoom in. The effect lasts
duration seconds.
queue_change_offset
func queue_change_offset(offset = Vector2.ZERO) -> Callable
Changes the main camera's offset by offset pixels. Useful when zooming the camera.
This method is intended to be used inside a queue() of instructions.
queue_change_zoom
func queue_change_zoom(target = Vector2.ONE, duration = 1.0) -> Callable
Changes the camera zoom. If target is greater than Vector2(1, 1), the
camera will zoom out; smaller values will make it zoom in. The effect lasts
duration seconds.
This method is intended to be used inside a queue() of instructions.
queue_shake
func queue_shake(strength = 1.0, duration = 1.0) -> Callable
Makes the camera shake with strength intensity for duration seconds.
This method is intended to be used inside a queue() of instructions.
queue_shake_bg
func queue_shake_bg(strength = 1.0, duration = 1.0) -> Callable
Makes the camera shake with strength intensity for duration seconds without
blocking execution (runs in the background).
This method is intended to be used inside a queue() of instructions.
restore_default_limits
func restore_default_limits() -> void
Restores the camera limits to their default values.
shake
func shake(strength = 1.0, duration = 1.0) -> void
Makes the camera shake with strength intensity for duration seconds.
shake_bg
func shake_bg(strength = 1.0, duration = 1.0) -> void
Makes the camera shake with strength intensity for duration seconds without
blocking execution (runs in the background).
stop_shake
func stop_shake() -> void
Makes the camera stop shaking.