2026-03-03 02:00:36 +00:00
|
|
|
class_name Crate extends RigidBody2D
|
2026-03-09 20:48:04 +00:00
|
|
|
|
|
|
|
|
var teleport_target: Vector2 = Vector2.ZERO
|
|
|
|
|
var should_teleport: bool = false
|
|
|
|
|
|
|
|
|
|
func teleport_to(position: Vector2):
|
|
|
|
|
teleport_target = position
|
|
|
|
|
should_teleport = true
|
|
|
|
|
|
|
|
|
|
# called during physics processing, allowing you to safely read and modify the simulation state of a RigidBody2D
|
|
|
|
|
func _integrate_forces(state: PhysicsDirectBodyState2D):
|
|
|
|
|
if should_teleport:
|
|
|
|
|
state.transform = Transform2D.IDENTITY.translated(teleport_target)
|
|
|
|
|
should_teleport = false
|