Refactored Small Crouching and Big Crouching

- Added new variables to `CharacterInfo.json`
- Made it so `BlockCollision` area position is attached to top of `SmallCollision` and `BigCollision`
This commit is contained in:
KirbyKidJ
2025-10-09 15:16:14 -07:00
parent 0f628302cb
commit e6bc64affb
8 changed files with 56 additions and 56 deletions

View File

@@ -3,10 +3,16 @@ extends CollisionPolygon2D
@export var offset := Vector2.ZERO
@export var height := 0.0
@export var hitbox := Vector3.ONE
var crouching := false
func _physics_process(_delta: float) -> void:
scale = Vector2(hitbox.x, hitbox.y)
if crouching and get_meta("scalable", true): scale.y *= hitbox.z
update()
func update() -> void:
var height_to_use = height
position.y = -height_to_use / 2 * scale.y - offset.y
if get_meta("scalable", true):
position.y = -height_to_use / 2 * scale.y - offset.y