ScalableCollisionPolygon.gd 258 B

123456789101112
  1. @tool
  2. extends CollisionPolygon2D
  3. @export var offset := Vector2.ZERO
  4. @export var height := 0.0
  5. func _physics_process(_delta: float) -> void:
  6. update()
  7. func update() -> void:
  8. var height_to_use = height
  9. position.y = -height_to_use / 2 * scale.y - offset.y