ft: wrapping manager overhaul

This commit is contained in:
2026-03-01 14:11:28 +01:00
parent 99de1fc113
commit f83b290f5c
24 changed files with 221 additions and 182 deletions

View File

@@ -0,0 +1,22 @@
extends CharacterBody2D
var desired_rotation: float = self.rotation
@export var speed = 0.8
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
# smoothly rotate
if self.rotation != self.desired_rotation:
self.rotation = lerp_angle(self.rotation, self.desired_rotation, clampf(4 * delta, 0, 1))
func move(motion: Vector3, mod: float) -> void:
self.desired_rotation = atan2(motion.y, motion.x)
move_and_collide(Vector2(motion.x, motion.y).normalized() * self.speed * mod) # Moves along the given vector
# Apply boundary to new position
position = GameManager.get_boundaried_position(position)
func duplicate_init() -> void:
var sight = $Sight
remove_child(sight)
sight.queue_free()