Prepping for new model.
This commit is contained in:
parent
c6de01ba1a
commit
7a3318e5f6
|
|
@ -380,6 +380,39 @@ func is_out_of_range(value: float, a: float, b: float) -> bool:
|
|||
var upper = max(a, b)
|
||||
return value <= lower or value >= upper
|
||||
|
||||
enum RANGE_PLACEMENT {
|
||||
BEFORE_RANGE,
|
||||
WITHIN_RANGE,
|
||||
PAST_RANGE
|
||||
}
|
||||
|
||||
## Determine the trend of direction and where our current speed is
|
||||
# in relation to it. This should help determine the direction of
|
||||
# acceleration and whether we speed up or slow down.
|
||||
##
|
||||
func placement_to_speed_range(speed: float, speed_range: Vector2) -> int:
|
||||
## Actually we don't care about mix or min
|
||||
#var range_start :float = min(speed_range.x, speed_range.y)
|
||||
#var range_end :float = max(speed_range.x, speed_range.y)
|
||||
|
||||
## We can be at the base range to ensure impulse can happen
|
||||
## Direction <-- that way
|
||||
if speed_range.x > speed_range.y:
|
||||
if speed < speed_range.x and speed >= speed_range.y:
|
||||
return RANGE_PLACEMENT.WITHIN_RANGE
|
||||
elif speed < speed_range.y:
|
||||
return RANGE_PLACEMENT.PAST_RANGE
|
||||
else:
|
||||
return RANGE_PLACEMENT.BEFORE_RANGE
|
||||
else: ## Direction --> that way
|
||||
if speed > speed_range.x and speed <= speed_range.y:
|
||||
return RANGE_PLACEMENT.WITHIN_RANGE
|
||||
elif speed > speed_range.y:
|
||||
return RANGE_PLACEMENT.PAST_RANGE
|
||||
else:
|
||||
return RANGE_PLACEMENT.BEFORE_RANGE
|
||||
return 0
|
||||
|
||||
## Passed in acceleration, vel, etc is applied to whatever
|
||||
## the parent is. If Kinematic then move_and_slide, otherwise manually adjusted
|
||||
func apply_movement_to_parent( _velocity :Vector2) -> void:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user