tried some stuff with getting the region right... not working
This commit is contained in:
@@ -2,7 +2,8 @@ extends CharacterBody2D
|
||||
|
||||
@export var unitData = {
|
||||
"MoveRange": 5,
|
||||
"MoveRangeV": Vector2i(5, 5),
|
||||
"MoveRangeVi": Vector2i(5, 5),
|
||||
"MoveRangeV": Vector2(5, 5),
|
||||
"Speed": 400.0
|
||||
}
|
||||
|
||||
@@ -63,7 +64,7 @@ func _physics_process(delta: float) -> void:
|
||||
currentCell = pos_to_cell(global_position)
|
||||
$PathPrev.points = [];
|
||||
moving = false; MoveFinished.emit();
|
||||
MapGlobal.SetRegion(calculateMovementRegion(), unitData["MoveRangeV"])
|
||||
MapGlobal.SetRegion(calculateMovementRegion(), -unitData["MoveRangeVi"])
|
||||
|
||||
else:
|
||||
var direction = (movePts[currentPoint+1] - movePts[currentPoint]).normalized()
|
||||
@@ -80,6 +81,5 @@ func selectUnit(cell: Vector2i):
|
||||
selected = false
|
||||
|
||||
func calculateMovementRegion():
|
||||
var region := Rect2i(pos_to_cell(global_position), Vector2i(unitData["MoveRange"], unitData["MoveRange"]))
|
||||
region.set_center
|
||||
var region := Rect2i(pos_to_cell(global_position - unitData["MoveRangeV"]), unitData["MoveRangeVi"] * 2)
|
||||
return region
|
||||
|
||||
Reference in New Issue
Block a user