Compare commits
No commits in common. "e2c77b05e36c15b5581cf23985ff34799ec611ca" and "d422ae61dd61bdaad0189331cad2c04e493c656d" have entirely different histories.
e2c77b05e3
...
d422ae61dd
|
|
@ -1,18 +1,11 @@
|
||||||
class_name MovementParameters
|
class_name MovementParameters
|
||||||
extends Reference
|
extends Reference
|
||||||
|
|
||||||
# Allow floats from -10 to 20 and snap the value to multiples of 0.2.
|
## Vector based ones for x and y
|
||||||
|
export var base_move_speed :Vector2
|
||||||
export(PoolVector2Array) var _speed_start = PoolVector2Array([Vector2(0,0),Vector2(0,0),Vector2(0,0)])
|
export var base_move_acceleration :Vector2
|
||||||
export(PoolVector2Array) var _speed_end = PoolVector2Array([Vector2(0,0),Vector2(0,0),Vector2(0,0)])
|
export var move_speed_modifier :Vector2
|
||||||
|
export var move_speed_modifier_acceleration :Vector2
|
||||||
## MP accelleration is reflective of minimum maximum and adjusted accel
|
|
||||||
## It can be accessed directly now, doesn't need the direction
|
|
||||||
export(Vector2) var _acceleration = Vector2(0,0)
|
|
||||||
const BASE_ACCELERATION = 0
|
|
||||||
const MAX_ACCELERATION = 1
|
|
||||||
const MIN_ACCELERATION = 2 # or -1
|
|
||||||
|
|
||||||
export var jerk_factor :Vector2
|
export var jerk_factor :Vector2
|
||||||
|
|
||||||
var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity")
|
var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity")
|
||||||
|
|
@ -21,38 +14,15 @@ var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity")
|
||||||
## Can be set to help with debugging the velocity controller
|
## Can be set to help with debugging the velocity controller
|
||||||
export var debug_name :String
|
export var debug_name :String
|
||||||
|
|
||||||
func get_speed_start(direction :int) -> Vector2:
|
# export var base_h_move_speed :float
|
||||||
return _speed_start[direction]
|
# export var base_h_move_acceleration :float
|
||||||
|
# export var h_move_speed_modifier :float
|
||||||
func set_speed_start(direction :int, value :Vector2) -> void:
|
# export var h_move_modifier_move_acceleration :float
|
||||||
_speed_start[direction] = value
|
|
||||||
|
|
||||||
func get_speed_end(direction :int) -> Vector2:
|
|
||||||
return _speed_end[direction]
|
|
||||||
|
|
||||||
func set_speed_end(direction :int, value :Vector2) -> void:
|
|
||||||
_speed_end[direction] = value
|
|
||||||
|
|
||||||
func get_acceleration() -> Vector2:
|
|
||||||
return _acceleration
|
|
||||||
|
|
||||||
## Sort of the conditional clamp of acceleration parameters
|
|
||||||
func set_acceleration(value :Vector2, min_value :Vector2, max_value :Vector2) -> void:
|
|
||||||
var adjusted_accel = value
|
|
||||||
if adjusted_accel.x < min_value.x:
|
|
||||||
adjusted_accel.x = min_value.x
|
|
||||||
if adjusted_accel.y < min_value.y:
|
|
||||||
adjusted_accel.y = min_value.y
|
|
||||||
|
|
||||||
if max_value.x != 0:
|
|
||||||
if adjusted_accel.x > max_value.x:
|
|
||||||
adjusted_accel.x = max_value.x
|
|
||||||
if max_value.y != 0:
|
|
||||||
if adjusted_accel.y > max_value.y:
|
|
||||||
adjusted_accel.y = max_value.y
|
|
||||||
|
|
||||||
_acceleration = adjusted_accel
|
|
||||||
|
|
||||||
|
# export var base_v_move_speed :float
|
||||||
|
# export var base_v_move_acceleration :float
|
||||||
|
# export var v_move_speed_modifier :float
|
||||||
|
# export var v_move_modifier_move_acceleration :float
|
||||||
|
|
||||||
func modify(_movement_parameters :MovementParameters):
|
func modify(_movement_parameters :MovementParameters):
|
||||||
pass
|
pass
|
||||||
|
|
@ -60,68 +30,61 @@ func modify(_movement_parameters :MovementParameters):
|
||||||
func apply_multiple_modifiers( _modifiers: Array, _movement_direction :Vector2):
|
func apply_multiple_modifiers( _modifiers: Array, _movement_direction :Vector2):
|
||||||
for m in _modifiers:
|
for m in _modifiers:
|
||||||
if m is StateModifierMovement:
|
if m is StateModifierMovement:
|
||||||
##TODO: Check sign of direction here or maybe further down?
|
|
||||||
# if m.direction != sign(_movement_direction):
|
|
||||||
# pass
|
|
||||||
apply_state_modifier(m, _movement_direction)
|
apply_state_modifier(m, _movement_direction)
|
||||||
|
|
||||||
func apply_state_modifier(_modifier :StateModifierMovement, _movement_direction :Vector2):
|
func apply_state_modifier(_modifier :StateModifierMovement, _movement_direction :Vector2):
|
||||||
##TODO: probably math the min and max as well somehow
|
#_modifier.direction == _modifier.APPLIED_DIRECTIONS.LEFT_OR_UP
|
||||||
## Accel processing is the same regardless of direction now
|
match _modifier.modifier_type:
|
||||||
set_acceleration( ( _acceleration + _modifier.acceleration),
|
|
||||||
_modifier.min_acceleration,
|
|
||||||
_modifier.max_acceleration )
|
|
||||||
|
|
||||||
match _modifier.processing_mode:
|
|
||||||
StateModifierMovement.SUB_TYPE.NEGATIVE_CONSTRAINT:
|
StateModifierMovement.SUB_TYPE.NEGATIVE_CONSTRAINT:
|
||||||
|
var adjusted_move_speed = base_move_speed.x + _modifier.horizontal_speed
|
||||||
var speed :Vector2 = get_speed_start(_modifier.direction)
|
## We crossed the zero from the base
|
||||||
var adjusted_move_speed = get_speed_start(_modifier.direction) + _modifier.speed_start
|
if sign(adjusted_move_speed) != sign(base_move_speed.x):
|
||||||
if sign(adjusted_move_speed.x) != sign(speed.x):
|
base_move_speed.x = 0.0
|
||||||
speed.x = 0.0
|
|
||||||
else:
|
else:
|
||||||
speed.x = adjusted_move_speed.x
|
base_move_speed.x = adjusted_move_speed
|
||||||
if sign(adjusted_move_speed.y) != sign(speed.y):
|
var adjusted_accel = base_move_acceleration.x + _modifier.horizontal_acceleration
|
||||||
speed.y = 0.0
|
if sign(adjusted_accel) != sign(base_move_acceleration.x):
|
||||||
|
base_move_acceleration.x = 0.0
|
||||||
else:
|
else:
|
||||||
speed.y = adjusted_move_speed.y
|
base_move_acceleration.x = adjusted_accel
|
||||||
set_speed_start(_modifier.direction, speed)
|
|
||||||
|
|
||||||
speed = get_speed_end(_modifier.direction)
|
|
||||||
adjusted_move_speed = get_speed_end(_modifier.direction) + _modifier.speed_end
|
|
||||||
if sign(adjusted_move_speed.x) != sign(speed.x):
|
|
||||||
speed.x = 0.0
|
|
||||||
else:
|
|
||||||
speed.x = adjusted_move_speed.x
|
|
||||||
if sign(adjusted_move_speed.y) != sign(speed.y):
|
|
||||||
speed.y = 0.0
|
|
||||||
else:
|
|
||||||
speed.y = adjusted_move_speed.y
|
|
||||||
set_speed_end(_modifier.direction, speed)
|
|
||||||
|
|
||||||
|
|
||||||
if (true): #DEGUG
|
|
||||||
var foo = 2+2
|
|
||||||
|
|
||||||
|
|
||||||
|
##TODO: Um, modifiers are a little weirder for this
|
||||||
|
#move_speed_modifier.x += _modifier.horizontal_speed_offset
|
||||||
|
var speed_differance = base_move_speed.x + (move_speed_modifier.x + _modifier.horizontal_speed_offset)
|
||||||
|
if sign(speed_differance) != sign(base_move_speed.x) and base_move_speed.x != 0:
|
||||||
|
## Add the inverse of the modifier instead
|
||||||
|
move_speed_modifier.x += speed_differance * - 1
|
||||||
|
else:
|
||||||
|
move_speed_modifier.x += _modifier.horizontal_speed_offset
|
||||||
|
|
||||||
|
move_speed_modifier_acceleration.x += _modifier.horizontal_speed_offset_acceleration
|
||||||
|
move_speed_modifier.y += _modifier.vertical_speed_offset
|
||||||
|
move_speed_modifier_acceleration.y += _modifier.vertical_speed_offset_acceleration
|
||||||
_:
|
_:
|
||||||
|
base_move_speed.x += _modifier.horizontal_speed
|
||||||
set_speed_start(
|
base_move_acceleration.x += _modifier.horizontal_acceleration
|
||||||
_modifier.direction,
|
move_speed_modifier.x += _modifier.horizontal_speed_offset
|
||||||
(get_speed_start(_modifier.direction) + _modifier.speed_start)
|
move_speed_modifier_acceleration.x += _modifier.horizontal_speed_offset_acceleration
|
||||||
)
|
|
||||||
set_speed_end(
|
|
||||||
_modifier.direction,
|
|
||||||
(get_speed_end(_modifier.direction) + _modifier.speed_end)
|
|
||||||
)
|
|
||||||
|
|
||||||
if (true): #DEGUG
|
base_move_speed.y += _modifier.vertical_speed
|
||||||
var foo = 2+2
|
base_move_acceleration.y += _modifier.vertical_acceleration
|
||||||
|
move_speed_modifier.y += _modifier.vertical_speed_offset
|
||||||
|
move_speed_modifier_acceleration.y += _modifier.vertical_speed_offset_acceleration
|
||||||
|
|
||||||
# UiManager.debug_text = ( #"H_Speed x Dir: " + str(h_speed) + str('duh') +
|
UiManager.debug_text = ( #"H_Speed x Dir: " + str(h_speed) + str('duh') +
|
||||||
# "BaseSpeed Fm:{0} To:{1}".format({"0":"%5.2f" % base_move_speed.x, "1":"%5.2f" % base_move_speed.y}) +
|
"BaseSpeed Fm:{0} To:{1}".format({"0":"%5.2f" % base_move_speed.x, "1":"%5.2f" % base_move_speed.y}) +
|
||||||
# "\nSpeedMod Fm:{0} To:{1}".format({"0":"%5.2f" % move_speed_modifier.x, "1":"%5.2f" % move_speed_modifier.y}) +
|
"\nSpeedMod Fm:{0} To:{1}".format({"0":"%5.2f" % move_speed_modifier.x, "1":"%5.2f" % move_speed_modifier.y}) +
|
||||||
# "\nMoveAccel: {0}, {1}".format({"0":"%4.1f" % base_move_acceleration.x, "1":"%4.1f" % base_move_acceleration.y}) +
|
"\nMoveAccel: {0}, {1}".format({"0":"%4.1f" % base_move_acceleration.x, "1":"%4.1f" % base_move_acceleration.y}) +
|
||||||
# "\nType: " + str(_modifier.modifier_type)
|
"\nType: " + str(_modifier.modifier_type)
|
||||||
# )
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# var movement_params :Dictionary = {
|
||||||
|
# "_base_h_move_speed" : _state.horizontal_speed,
|
||||||
|
# "_base_h_move_acceleration" : _state.horizontal_acceleration,
|
||||||
|
# "_base_h_move_speed_modifier" : _state.horizontal_speed_offset,
|
||||||
|
# "_base_h_move_modifier_move_acceleration" : _state.horizontal_speed_offset_acceleration,
|
||||||
|
# "_jerk_factor" : _state.jerk_factor,
|
||||||
|
# "_gravity" : _state.gravity
|
||||||
|
# }
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,6 @@ func process_physics(delta):
|
||||||
# more likely needed for Players
|
# more likely needed for Players
|
||||||
func process_physics_input(delta):
|
func process_physics_input(delta):
|
||||||
physics_delta = delta
|
physics_delta = delta
|
||||||
desired_movement_vector = Vector2(0,0)
|
|
||||||
if has_method('_state_process_physics_input_' + current_state.name):
|
if has_method('_state_process_physics_input_' + current_state.name):
|
||||||
call('_state_process_physics_input_' + current_state.name)
|
call('_state_process_physics_input_' + current_state.name)
|
||||||
|
|
||||||
|
|
@ -156,8 +155,7 @@ func apply_state_modifier(movement_parameters :MovementParameters) -> MovementPa
|
||||||
var active_mods :bool= true
|
var active_mods :bool= true
|
||||||
var mods :Array = get_state_machine_modifiers.call_func('StateModifierMovement', active_mods, current_state.is_grounded)
|
var mods :Array = get_state_machine_modifiers.call_func('StateModifierMovement', active_mods, current_state.is_grounded)
|
||||||
if (mods.size() > 0):
|
if (mods.size() > 0):
|
||||||
## Process mods and supply current velocity for single directions
|
movement_parameters.apply_multiple_modifiers(mods, Vector2(0,0))
|
||||||
movement_parameters.apply_multiple_modifiers(mods, velocity_controller.velocity)
|
|
||||||
return movement_parameters
|
return movement_parameters
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,22 +7,7 @@ extends State
|
||||||
##
|
##
|
||||||
## @WIP
|
## @WIP
|
||||||
|
|
||||||
const RELATIVE_DIRECTION = 0
|
|
||||||
|
|
||||||
# Movement Speed in Pixels Per Second
|
# Movement Speed in Pixels Per Second
|
||||||
export(Vector2) var speed_start = Vector2(0,0)
|
|
||||||
export(Vector2) var speed_end = Vector2(0,1000) ## Terminal velocity
|
|
||||||
export(Vector2) var min_acceleration = Vector2(0,0)
|
|
||||||
export(Vector2) var acceleration = Vector2(0,280)
|
|
||||||
export(Vector2) var max_acceleration = Vector2(0,0)
|
|
||||||
export(Vector2) var jerk_factor = Vector2(1,1)
|
|
||||||
#export(Vector2) var speed_start_positive
|
|
||||||
#export(Vector2) var speed_end_positive
|
|
||||||
#export(Vector2) var acceleration_positive
|
|
||||||
#export(Vector2) var speed_start_negative
|
|
||||||
#export(Vector2) var speed_end_negative
|
|
||||||
#export(Vector2) var acceleration_negative
|
|
||||||
|
|
||||||
# The base movement speed and accelleration
|
# The base movement speed and accelleration
|
||||||
export var horizontal_speed: float = 60
|
export var horizontal_speed: float = 60
|
||||||
export var horizontal_acceleration: float = 0
|
export var horizontal_acceleration: float = 0
|
||||||
|
|
@ -30,7 +15,7 @@ export var horizontal_acceleration: float = 0
|
||||||
export var horizontal_speed_offset: float = 0
|
export var horizontal_speed_offset: float = 0
|
||||||
## Applies only if offset applies
|
## Applies only if offset applies
|
||||||
export var horizontal_speed_offset_acceleration: float = 0
|
export var horizontal_speed_offset_acceleration: float = 0
|
||||||
#export var jerk_factor: float = 1.0
|
export var jerk_factor: float = 1.0
|
||||||
|
|
||||||
export var vertical_speed: float = 0
|
export var vertical_speed: float = 0
|
||||||
export var vertical_acceleration: float = 0
|
export var vertical_acceleration: float = 0
|
||||||
|
|
@ -40,7 +25,7 @@ export var vertical_speed_offset: float = 0
|
||||||
export var vertical_speed_offset_acceleration: float = 0
|
export var vertical_speed_offset_acceleration: float = 0
|
||||||
|
|
||||||
export var horizontal_jerk_factor: float = 1.0
|
export var horizontal_jerk_factor: float = 1.0
|
||||||
export var vertical_jerk_factor: float = 1.0
|
export var vertical_jerk_factor: float = 1.0
|
||||||
|
|
||||||
## Should this state keep the inertia from previous states
|
## Should this state keep the inertia from previous states
|
||||||
export var preserve_inertia :bool = true
|
export var preserve_inertia :bool = true
|
||||||
|
|
@ -72,25 +57,15 @@ func enter() -> void:
|
||||||
|
|
||||||
func get_movement_parameters() -> MovementParameters:
|
func get_movement_parameters() -> MovementParameters:
|
||||||
var movement_parameters = MovementParameters.new()
|
var movement_parameters = MovementParameters.new()
|
||||||
|
|
||||||
movement_parameters.debug_name = name
|
movement_parameters.debug_name = name
|
||||||
movement_parameters.set_speed_start(RELATIVE_DIRECTION, speed_start)
|
movement_parameters.base_move_speed.x = horizontal_speed
|
||||||
#movement_parameters.speed_start = speed_start
|
movement_parameters.base_move_acceleration.x = horizontal_acceleration
|
||||||
movement_parameters.set_speed_end(RELATIVE_DIRECTION, speed_end)
|
movement_parameters.move_speed_modifier.x = horizontal_speed_offset
|
||||||
#movement_parameters.speed_end = speed_end
|
movement_parameters.move_speed_modifier_acceleration.x = horizontal_speed_offset_acceleration
|
||||||
movement_parameters.set_acceleration(acceleration, min_acceleration, max_acceleration)
|
movement_parameters.base_move_speed.y = vertical_speed
|
||||||
#movement_parameters.acceleration = acceleration
|
movement_parameters.base_move_acceleration.y = vertical_acceleration
|
||||||
movement_parameters.jerk_factor = jerk_factor
|
movement_parameters.move_speed_modifier.y = vertical_speed_offset
|
||||||
|
movement_parameters.move_speed_modifier_acceleration.y = vertical_speed_offset_acceleration
|
||||||
## Old stuff
|
|
||||||
# movement_parameters.base_move_speed.x = horizontal_speed
|
|
||||||
# movement_parameters.base_move_acceleration.x = horizontal_acceleration
|
|
||||||
# movement_parameters.move_speed_modifier.x = horizontal_speed_offset
|
|
||||||
# movement_parameters.move_speed_modifier_acceleration.x = horizontal_speed_offset_acceleration
|
|
||||||
# movement_parameters.base_move_speed.y = vertical_speed
|
|
||||||
# movement_parameters.base_move_acceleration.y = vertical_acceleration
|
|
||||||
# movement_parameters.move_speed_modifier.y = vertical_speed_offset
|
|
||||||
# movement_parameters.move_speed_modifier_acceleration.y = vertical_speed_offset_acceleration
|
|
||||||
|
|
||||||
|
|
||||||
return movement_parameters
|
return movement_parameters
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,24 @@
|
||||||
class_name StateModifierMovement
|
class_name StateModifierMovement
|
||||||
extends StateModifier
|
extends StateModifier
|
||||||
|
|
||||||
#export(float, -1.0, 1, 1.0) var applied_direction = 0
|
## Movement Modifiers
|
||||||
|
export var horizontal_speed: float = 0
|
||||||
|
export var horizontal_acceleration: float = 0
|
||||||
|
## Movement Speed Offsets (Positive or Negative)
|
||||||
|
export var horizontal_speed_offset: float = 0
|
||||||
|
## Applies only if offset applies
|
||||||
|
export var horizontal_speed_offset_acceleration: float = 0
|
||||||
|
#export var jerk_factor: float = 0
|
||||||
|
|
||||||
|
export var vertical_speed: float = 0
|
||||||
|
export var vertical_acceleration: float = 0
|
||||||
|
## Movement Speed Offsets (Positive or Negative)
|
||||||
|
export var vertical_speed_offset: float = 0
|
||||||
|
## Applies only if offset applies
|
||||||
|
export var vertical_speed_offset_acceleration: float = 0
|
||||||
|
|
||||||
|
export var gravity: int = 0
|
||||||
|
|
||||||
#export (Transform2D) var speed = Transform2D(Vector2(0,0),Vector2(0,0),Vector2(0,0))
|
|
||||||
#export(float, EXP, -1, 1, .1) var jerk_offset = 0
|
|
||||||
## Processing Directives (help determine how the merge function works)
|
## Processing Directives (help determine how the merge function works)
|
||||||
enum APPLIED_DIRECTIONS {
|
enum APPLIED_DIRECTIONS {
|
||||||
LEFT_OR_UP = -1,
|
LEFT_OR_UP = -1,
|
||||||
|
|
@ -12,36 +26,7 @@ enum APPLIED_DIRECTIONS {
|
||||||
RIGHT_OR_DOWN = 1
|
RIGHT_OR_DOWN = 1
|
||||||
}
|
}
|
||||||
export(APPLIED_DIRECTIONS) var direction :float = float(APPLIED_DIRECTIONS.RELATIVE) # -1, 0, 1
|
export(APPLIED_DIRECTIONS) var direction :float = float(APPLIED_DIRECTIONS.RELATIVE) # -1, 0, 1
|
||||||
|
|
||||||
export(Vector2) var speed_start
|
|
||||||
export(Vector2) var speed_end
|
|
||||||
export(Vector2) var min_acceleration = Vector2(0,0)
|
|
||||||
export(Vector2) var acceleration = Vector2(0,0)
|
|
||||||
export(Vector2) var max_acceleration = Vector2(0,0)
|
|
||||||
|
|
||||||
## Movement Modifiers
|
|
||||||
#export var horizontal_speed: float = 0
|
|
||||||
#export var horizontal_acceleration: float = 0
|
|
||||||
### Movement Speed Offsets (Positive or Negative)
|
|
||||||
#export var horizontal_speed_offset: float = 0
|
|
||||||
### Applies only if offset applies
|
|
||||||
#export var horizontal_speed_offset_acceleration: float = 0
|
|
||||||
##export var jerk_factor: float = 0
|
|
||||||
#
|
|
||||||
#export var vertical_speed: float = 0
|
|
||||||
#export var vertical_acceleration: float = 0
|
|
||||||
### Movement Speed Offsets (Positive or Negative)
|
|
||||||
#export var vertical_speed_offset: float = 0
|
|
||||||
### Applies only if offset applies
|
|
||||||
#export var vertical_speed_offset_acceleration: float = 0
|
|
||||||
|
|
||||||
export var gravity: int = 0
|
|
||||||
|
|
||||||
export var only_grounded :bool = false
|
export var only_grounded :bool = false
|
||||||
## Properties of modifier only take place when velocity is moving in this direction
|
|
||||||
## Honestly I'm not sure when this would come up so it's maybe not worth building for.
|
|
||||||
## A speed boost that only works in one direction? Why?
|
|
||||||
#export var only_apply_in_single_direction :bool = false
|
|
||||||
|
|
||||||
## Ways to determine how modifiers are applied to movement parameters
|
## Ways to determine how modifiers are applied to movement parameters
|
||||||
enum SUB_TYPE {
|
enum SUB_TYPE {
|
||||||
|
|
@ -58,24 +43,21 @@ func _to_string():
|
||||||
func reset():
|
func reset():
|
||||||
.reset()
|
.reset()
|
||||||
modifier_type = SUB_TYPE.NONE
|
modifier_type = SUB_TYPE.NONE
|
||||||
# direction = 0.0
|
direction = 0.0
|
||||||
# horizontal_speed = 0
|
horizontal_speed = 0
|
||||||
# horizontal_acceleration = 0
|
horizontal_acceleration = 0
|
||||||
# ## Movement Speed Offsets (Positive or Negative)
|
## Movement Speed Offsets (Positive or Negative)
|
||||||
# horizontal_speed_offset = 0
|
horizontal_speed_offset = 0
|
||||||
# ## Applies only if offset applies
|
## Applies only if offset applies
|
||||||
# horizontal_speed_offset_acceleration = 0
|
horizontal_speed_offset_acceleration = 0
|
||||||
#jerk_factor = 0
|
#jerk_factor = 0
|
||||||
|
|
||||||
func copy(_copy_state: StateModifier):
|
func copy(_copy_state: StateModifier):
|
||||||
.copy(_copy_state)
|
.copy(_copy_state)
|
||||||
modifier_type = _copy_state.modifier_type
|
modifier_type = _copy_state.modifier_type
|
||||||
if _copy_state.to_string() == "StateModifierMovement":
|
if _copy_state.to_string() == "StateModifierMovement":
|
||||||
#_copy_state.horizontal_speed = horizontal_speed
|
_copy_state.horizontal_speed = horizontal_speed
|
||||||
_copy_state.speed.start = speed_start
|
_copy_state.horizontal_acceleration = horizontal_acceleration
|
||||||
_copy_state.speed_end = speed_end
|
|
||||||
#_copy_state.horizontal_acceleration = horizontal_acceleration
|
|
||||||
_copy_state.acceleration = acceleration
|
|
||||||
|
|
||||||
## Overrident to check whether this state is a grounded and this modifier
|
## Overrident to check whether this state is a grounded and this modifier
|
||||||
## should only apply while in the air.
|
## should only apply while in the air.
|
||||||
|
|
@ -99,25 +81,13 @@ func merge(_merge_from_modifier: StateModifier):
|
||||||
##TODO: I don't really need merge functions here?
|
##TODO: I don't really need merge functions here?
|
||||||
match _merge_from_modifier.modifier_type:
|
match _merge_from_modifier.modifier_type:
|
||||||
_:
|
_:
|
||||||
speed_end += _merge_from_modifier.speed_end
|
horizontal_speed += _merge_from_modifier.horizontal_speed
|
||||||
speed_start += _merge_from_modifier.speed_start
|
horizontal_acceleration += _merge_from_modifier.horizontal_acceleration
|
||||||
acceleration += _merge_from_modifier.acceleration
|
horizontal_speed_offset += _merge_from_modifier.horizontal_speed_offset
|
||||||
if (_merge_from_modifier.min_acceleration.x < min_acceleration.x):
|
horizontal_speed_offset_acceleration += _merge_from_modifier.horizontal_speed_offset_acceleration
|
||||||
min_acceleration.x = _merge_from_modifier.min_acceleration.x
|
vertical_speed += _merge_from_modifier.vertical_speed
|
||||||
if (_merge_from_modifier.min_acceleration.y < min_acceleration.y):
|
vertical_acceleration += _merge_from_modifier.vertical_acceleration
|
||||||
min_acceleration.y = _merge_from_modifier.min_acceleration.y
|
vertical_speed_offset += _merge_from_modifier.vertical_speed_offset
|
||||||
if (_merge_from_modifier.max_acceleration.x > max_acceleration.x):
|
vertical_speed_offset_acceleration += _merge_from_modifier.vertical_speed_offset_acceleration
|
||||||
max_acceleration.x = _merge_from_modifier.max_acceleration.x
|
|
||||||
if (_merge_from_modifier.max_acceleration.y > max_acceleration.y):
|
|
||||||
max_acceleration.y = _merge_from_modifier.max_acceleration.y
|
|
||||||
|
|
||||||
# horizontal_speed += _merge_from_modifier.horizontal_speed
|
|
||||||
# horizontal_acceleration += _merge_from_modifier.horizontal_acceleration
|
|
||||||
# horizontal_speed_offset += _merge_from_modifier.horizontal_speed_offset
|
|
||||||
# horizontal_speed_offset_acceleration += _merge_from_modifier.horizontal_speed_offset_acceleration
|
|
||||||
# vertical_speed += _merge_from_modifier.vertical_speed
|
|
||||||
# vertical_acceleration += _merge_from_modifier.vertical_acceleration
|
|
||||||
# vertical_speed_offset += _merge_from_modifier.vertical_speed_offset
|
|
||||||
# vertical_speed_offset_acceleration += _merge_from_modifier.vertical_speed_offset_acceleration
|
|
||||||
direction = _merge_from_modifier.direction
|
direction = _merge_from_modifier.direction
|
||||||
only_grounded = _merge_from_modifier.only_grounded
|
only_grounded = _merge_from_modifier.only_grounded
|
||||||
|
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
extends Node
|
|
||||||
|
|
||||||
export (int) var player_count = 5
|
|
||||||
|
|
||||||
class SoundRequest:
|
|
||||||
var stream
|
|
||||||
var priority = 0
|
|
||||||
|
|
||||||
func _init(_stream: AudioStream, _priority: int = 0):
|
|
||||||
stream = _stream
|
|
||||||
priority = _priority
|
|
||||||
|
|
||||||
var players := []
|
|
||||||
var sound_queue := []
|
|
||||||
|
|
||||||
func _ready():
|
|
||||||
## Singletons don't run process unless explicitly enabled
|
|
||||||
set_process(true)
|
|
||||||
|
|
||||||
for i in range(player_count):
|
|
||||||
var player = AudioStreamPlayer.new()
|
|
||||||
add_child(player)
|
|
||||||
players.append(player)
|
|
||||||
|
|
||||||
func play_sound(stream: AudioStream, priority: int = 0):
|
|
||||||
# Try to find an available player
|
|
||||||
for i in range(player_count):
|
|
||||||
if not players[i].playing:
|
|
||||||
players[i].stream = stream
|
|
||||||
players[i].play()
|
|
||||||
return
|
|
||||||
|
|
||||||
##TODO: This may be slow, perhaps just a pop push front is good enough
|
|
||||||
# No player is available, add to queue
|
|
||||||
sound_queue.append(SoundRequest.new(stream, priority))
|
|
||||||
# Sort queue by priority (descending)
|
|
||||||
sound_queue.sort_custom(self, "_sort_by_priority")
|
|
||||||
|
|
||||||
func _process(_delta):
|
|
||||||
if sound_queue.empty():
|
|
||||||
return
|
|
||||||
|
|
||||||
for i in range(player_count):
|
|
||||||
if not players[i].playing:
|
|
||||||
var request = sound_queue.pop_front()
|
|
||||||
players[i].stream = request.stream
|
|
||||||
players[i].play()
|
|
||||||
# only play one queued sound per frame
|
|
||||||
break
|
|
||||||
|
|
||||||
func _sort_by_priority(a: SoundRequest, b: SoundRequest) -> bool:
|
|
||||||
return a.priority > b.priority
|
|
||||||
|
|
||||||
|
|
@ -224,7 +224,6 @@ PlayerInfo="*res://lib/singleton_autoloads/PlayerInfo.gd"
|
||||||
UiManager="*res://lib/singleton_autoloads/UIManager.gd"
|
UiManager="*res://lib/singleton_autoloads/UIManager.gd"
|
||||||
LevelInfo="*res://lib/singleton_autoloads/LevelInfo.gd"
|
LevelInfo="*res://lib/singleton_autoloads/LevelInfo.gd"
|
||||||
NetworkManager="*res://lib/singleton_autoloads/NetworkManager.gd"
|
NetworkManager="*res://lib/singleton_autoloads/NetworkManager.gd"
|
||||||
SoundEffectManager="*res://lib/singleton_autoloads/SoundEffectManager.gd"
|
|
||||||
|
|
||||||
[debug]
|
[debug]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,15 @@ script = ExtResource( 1 )
|
||||||
modifier_type = 0
|
modifier_type = 0
|
||||||
name = "ice_or_something"
|
name = "ice_or_something"
|
||||||
timeout_seconds = 0.0
|
timeout_seconds = 0.0
|
||||||
direction = 0
|
horizontal_speed = 0.0
|
||||||
speed_start = Vector2( -20, 1.36422e-12 )
|
horizontal_acceleration = -250.0
|
||||||
speed_end = Vector2( 0, 0 )
|
horizontal_speed_offset = 0.0
|
||||||
min_acceleration = Vector2( 30, 1.36422e-12 )
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
acceleration = Vector2( -250, 1.36422e-12 )
|
vertical_speed = 0.0
|
||||||
max_acceleration = Vector2( 0, 0 )
|
vertical_acceleration = 0.0
|
||||||
|
vertical_speed_offset = 0.0
|
||||||
|
vertical_speed_offset_acceleration = 0.0
|
||||||
gravity = 0
|
gravity = 0
|
||||||
|
direction = 0
|
||||||
only_grounded = true
|
only_grounded = true
|
||||||
processing_mode = 1
|
processing_mode = 0
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,15 @@ script = ExtResource( 1 )
|
||||||
modifier_type = 0
|
modifier_type = 0
|
||||||
name = "conveyor_left"
|
name = "conveyor_left"
|
||||||
timeout_seconds = 0.0
|
timeout_seconds = 0.0
|
||||||
direction = -1
|
horizontal_speed = -30.0
|
||||||
speed_start = Vector2( 30, 1.36422e-12 )
|
horizontal_acceleration = 0.0
|
||||||
speed_end = Vector2( 30, 1.36422e-12 )
|
horizontal_speed_offset = 0.0
|
||||||
min_acceleration = Vector2( 0, 0 )
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
acceleration = Vector2( 0, 0 )
|
vertical_speed = 0.0
|
||||||
max_acceleration = Vector2( 0, 0 )
|
vertical_acceleration = 0.0
|
||||||
|
vertical_speed_offset = 0.0
|
||||||
|
vertical_speed_offset_acceleration = 0.0
|
||||||
gravity = 0
|
gravity = 0
|
||||||
|
direction = -1
|
||||||
only_grounded = true
|
only_grounded = true
|
||||||
processing_mode = 0
|
processing_mode = 0
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,15 @@ script = ExtResource( 1 )
|
||||||
modifier_type = 0
|
modifier_type = 0
|
||||||
name = "wind_left"
|
name = "wind_left"
|
||||||
timeout_seconds = 0.0
|
timeout_seconds = 0.0
|
||||||
direction = 1
|
horizontal_speed = -30.0
|
||||||
speed_start = Vector2( 30, 1.36422e-12 )
|
horizontal_acceleration = 0.0
|
||||||
speed_end = Vector2( 30, 1.36422e-12 )
|
horizontal_speed_offset = 0.0
|
||||||
min_acceleration = Vector2( 0, 0 )
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
acceleration = Vector2( 0, 0 )
|
vertical_speed = 0.0
|
||||||
max_acceleration = Vector2( 0, 0 )
|
vertical_acceleration = 0.0
|
||||||
|
vertical_speed_offset = 0.0
|
||||||
|
vertical_speed_offset_acceleration = 0.0
|
||||||
gravity = 0
|
gravity = 0
|
||||||
|
direction = -1
|
||||||
only_grounded = false
|
only_grounded = false
|
||||||
processing_mode = 0
|
processing_mode = 0
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
extends Movement_StateReceiver
|
extends Movement_StateReceiver
|
||||||
|
|
||||||
export var debug_velocity_controller :bool = false
|
|
||||||
|
|
||||||
var parent_request_state_change :FuncRef
|
var parent_request_state_change :FuncRef
|
||||||
var parent_use_primary_item :FuncRef
|
var parent_use_primary_item :FuncRef
|
||||||
|
|
||||||
|
|
@ -13,9 +11,6 @@ onready var stamina_component = $"%Stamina_Component"
|
||||||
var state_stamina_cost :Dictionary
|
var state_stamina_cost :Dictionary
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
if debug_velocity_controller:
|
|
||||||
velocity_controller.debug = true
|
|
||||||
|
|
||||||
#var state_ref :State
|
#var state_ref :State
|
||||||
#var state_name :String
|
#var state_name :String
|
||||||
#state_name = 'jump'
|
#state_name = 'jump'
|
||||||
|
|
@ -51,7 +46,6 @@ func wants_jump() -> bool:
|
||||||
return true
|
return true
|
||||||
else:
|
else:
|
||||||
_wants_jump = false
|
_wants_jump = false
|
||||||
desired_movement_vector.y = DOWN
|
|
||||||
return false
|
return false
|
||||||
|
|
||||||
var _wants_crouch :bool
|
var _wants_crouch :bool
|
||||||
|
|
@ -123,6 +117,7 @@ func process_physics_input(delta):
|
||||||
# call the parent, Which would call the individuals
|
# call the parent, Which would call the individuals
|
||||||
.process_physics_input(delta)
|
.process_physics_input(delta)
|
||||||
# then process movement controls
|
# then process movement controls
|
||||||
|
physics_delta = delta
|
||||||
get_movement_direction()
|
get_movement_direction()
|
||||||
wants_jump()
|
wants_jump()
|
||||||
wants_crouch()
|
wants_crouch()
|
||||||
|
|
@ -140,38 +135,30 @@ func _state_process_physics_idle():
|
||||||
##Bugfix
|
##Bugfix
|
||||||
if _wants_jump:
|
if _wants_jump:
|
||||||
request_state_change.call_func('jump')
|
request_state_change.call_func('jump')
|
||||||
return
|
|
||||||
|
|
||||||
if _wants_crouch == true:
|
if _wants_crouch == true:
|
||||||
request_state_change.call_func('crouch')
|
request_state_change.call_func('crouch')
|
||||||
return
|
|
||||||
##TODO: May need that 'bump' logic to make velocity work.
|
##TODO: May need that 'bump' logic to make velocity work.
|
||||||
if desired_movement_vector.x != 0: # and velocity.x != 0:
|
if desired_movement_vector.x != 0: # and velocity.x != 0:
|
||||||
request_state_change.call_func('move')
|
request_state_change.call_func('move')
|
||||||
return
|
|
||||||
|
|
||||||
if !parent.is_on_floor():
|
if !parent.is_on_floor():
|
||||||
#return fall_state
|
#return fall_state
|
||||||
request_state_change.call_func('fall')
|
request_state_change.call_func('fall')
|
||||||
return
|
|
||||||
|
|
||||||
if _wants_roll == true:
|
if _wants_roll == true:
|
||||||
request_state_change.call_func('roll')
|
request_state_change.call_func('roll')
|
||||||
return
|
|
||||||
|
|
||||||
if _wants_attack_primary == true:
|
if _wants_attack_primary == true:
|
||||||
#request_state_change.call_func('attack_shoot')
|
#request_state_change.call_func('attack_shoot')
|
||||||
attack_primary()
|
attack_primary()
|
||||||
return
|
|
||||||
|
|
||||||
if _wants_attack_secondary == true:
|
if _wants_attack_secondary == true:
|
||||||
#parent_request_state_change.call_func('attack_sword')
|
#parent_request_state_change.call_func('attack_sword')
|
||||||
attack_secondary()
|
attack_secondary()
|
||||||
return
|
|
||||||
|
|
||||||
if $"%LadderDetector".is_colliding() and _wants_climb == true:
|
if $"%LadderDetector".is_colliding() and _wants_climb == true:
|
||||||
request_state_change.call_func('climb')
|
request_state_change.call_func('climb')
|
||||||
return
|
|
||||||
|
|
||||||
# var _v :Vector2 = new_move_actor_as_desired( physics_delta , current_state )
|
# var _v :Vector2 = new_move_actor_as_desired( physics_delta , current_state )
|
||||||
# apply_movement_to_parent(_v)
|
# apply_movement_to_parent(_v)
|
||||||
|
|
@ -192,7 +179,6 @@ func attack_primary():
|
||||||
var _item_state_name :String = parent_use_primary_item.call_func()
|
var _item_state_name :String = parent_use_primary_item.call_func()
|
||||||
if _item_state_name != '':
|
if _item_state_name != '':
|
||||||
request_state_change.call_func(_item_state_name)
|
request_state_change.call_func(_item_state_name)
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -201,7 +187,6 @@ func attack_secondary():
|
||||||
var _item_state_name :String = get_parent().use_secondary_item()
|
var _item_state_name :String = get_parent().use_secondary_item()
|
||||||
if _item_state_name != '':
|
if _item_state_name != '':
|
||||||
request_state_change.call_func(_item_state_name)
|
request_state_change.call_func(_item_state_name)
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
func _state_process_physics_attack_shoot():
|
func _state_process_physics_attack_shoot():
|
||||||
|
|
@ -213,37 +198,30 @@ func _state_process_physics_attack_shoot():
|
||||||
|
|
||||||
if current_state.animation_finished == true:
|
if current_state.animation_finished == true:
|
||||||
request_state_change.call_func('idle')
|
request_state_change.call_func('idle')
|
||||||
return
|
|
||||||
|
|
||||||
if !parent.is_on_floor():
|
if !parent.is_on_floor():
|
||||||
#return fall_state
|
#return fall_state
|
||||||
request_state_change.call_func('fall')
|
request_state_change.call_func('fall')
|
||||||
return
|
|
||||||
|
|
||||||
func _state_process_physics_attack_punch():
|
func _state_process_physics_attack_punch():
|
||||||
if current_state.animation_finished == true:
|
if current_state.animation_finished == true:
|
||||||
request_state_change.call_func('idle')
|
request_state_change.call_func('idle')
|
||||||
return
|
|
||||||
|
|
||||||
if !parent.is_on_floor():
|
if !parent.is_on_floor():
|
||||||
#return fall_state
|
#return fall_state
|
||||||
request_state_change.call_func('fall')
|
request_state_change.call_func('fall')
|
||||||
return
|
|
||||||
|
|
||||||
func _state_process_physics_attack_sword():
|
func _state_process_physics_attack_sword():
|
||||||
if current_state.animation_finished == true:
|
if current_state.animation_finished == true:
|
||||||
request_state_change.call_func('idle')
|
request_state_change.call_func('idle')
|
||||||
return
|
|
||||||
|
|
||||||
if !parent.is_on_floor():
|
if !parent.is_on_floor():
|
||||||
#return fall_state
|
#return fall_state
|
||||||
request_state_change.call_func('fall')
|
request_state_change.call_func('fall')
|
||||||
return
|
|
||||||
|
|
||||||
func _state_process_physics_roll():
|
func _state_process_physics_roll():
|
||||||
if current_state.animation_finished == true:
|
if current_state.animation_finished == true:
|
||||||
request_state_change.call_func('idle')
|
request_state_change.call_func('idle')
|
||||||
return
|
|
||||||
|
|
||||||
# Force role in facing direction
|
# Force role in facing direction
|
||||||
# instead of movement direction
|
# instead of movement direction
|
||||||
|
|
@ -253,11 +231,11 @@ func _state_process_physics_roll():
|
||||||
velocity_controller.calculate_velocity(
|
velocity_controller.calculate_velocity(
|
||||||
physics_delta ,
|
physics_delta ,
|
||||||
apply_state_modifier(current_state.get_movement_parameters()),
|
apply_state_modifier(current_state.get_movement_parameters()),
|
||||||
Vector2(parent.transform.x.x, desired_movement_vector.y) )
|
parent.transform.x )
|
||||||
)
|
)
|
||||||
# if !parent.is_on_floor():
|
if !parent.is_on_floor():
|
||||||
# #return fall_state
|
#return fall_state
|
||||||
# request_state_change.call_func('fall')
|
request_state_change.call_func('fall')
|
||||||
|
|
||||||
var level_transition_latch: bool
|
var level_transition_latch: bool
|
||||||
var level_enter_dir: float
|
var level_enter_dir: float
|
||||||
|
|
@ -280,7 +258,6 @@ func _state_process_physics_enter_right():
|
||||||
level_transition_latch = true
|
level_transition_latch = true
|
||||||
elif current_state.state_timeout.time_left == 0 and level_transition_latch == true:
|
elif current_state.state_timeout.time_left == 0 and level_transition_latch == true:
|
||||||
request_state_change.call_func('idle')
|
request_state_change.call_func('idle')
|
||||||
return
|
|
||||||
|
|
||||||
# Force role in facing direction
|
# Force role in facing direction
|
||||||
# instead of movement direction
|
# instead of movement direction
|
||||||
|
|
@ -289,19 +266,17 @@ func _state_process_physics_enter_right():
|
||||||
velocity_controller.calculate_velocity(
|
velocity_controller.calculate_velocity(
|
||||||
physics_delta ,
|
physics_delta ,
|
||||||
apply_state_modifier(current_state.get_movement_parameters()),
|
apply_state_modifier(current_state.get_movement_parameters()),
|
||||||
Vector2(parent.transform.x.x, desired_movement_vector.y) )
|
parent.transform.x )
|
||||||
)
|
)
|
||||||
|
|
||||||
func _state_process_physics_land():
|
func _state_process_physics_land():
|
||||||
$"%LedgeDetector".set_enabled(true)
|
$"%LedgeDetector".set_enabled(true)
|
||||||
if current_state.animation_finished == true:
|
if current_state.animation_finished == true:
|
||||||
request_state_change.call_func('idle')
|
request_state_change.call_func('idle')
|
||||||
return
|
|
||||||
|
|
||||||
if !parent.is_on_floor():
|
if !parent.is_on_floor():
|
||||||
#return fall_state
|
#return fall_state
|
||||||
request_state_change.call_func('fall')
|
request_state_change.call_func('fall')
|
||||||
return
|
|
||||||
#move_actor_as_desired()
|
#move_actor_as_desired()
|
||||||
apply_movement_to_parent(
|
apply_movement_to_parent(
|
||||||
velocity_controller.calculate_velocity(
|
velocity_controller.calculate_velocity(
|
||||||
|
|
@ -313,7 +288,6 @@ func _state_process_physics_land():
|
||||||
func _state_process_physics_hurt():
|
func _state_process_physics_hurt():
|
||||||
if current_state.state_timeout.time_left == 0:
|
if current_state.state_timeout.time_left == 0:
|
||||||
request_state_change.call_func('idle')
|
request_state_change.call_func('idle')
|
||||||
return
|
|
||||||
|
|
||||||
# if !parent.is_on_floor():
|
# if !parent.is_on_floor():
|
||||||
# #return fall_state
|
# #return fall_state
|
||||||
|
|
@ -330,20 +304,17 @@ func _state_process_physics_hurt():
|
||||||
|
|
||||||
func _state_process_physics_fall():
|
func _state_process_physics_fall():
|
||||||
flip_sprite_to_movement_direction()
|
flip_sprite_to_movement_direction()
|
||||||
var foo = $"%LedgeDetector".is_colliding()
|
|
||||||
var bar = $"%WallDetector".is_colliding()
|
|
||||||
|
|
||||||
if $"%LedgeDetector".is_colliding() and !$"%WallDetector".is_colliding():
|
if $"%LedgeDetector".is_colliding() and !$"%WallDetector".is_colliding():
|
||||||
#print("it touched me!")
|
#print("it touched me!")
|
||||||
if debug_component:
|
if debug_component:
|
||||||
UiManager.debug_text = (str($"%LedgeDetector".get_collision_point()))
|
UiManager.debug_text = (str($"%LedgeDetector".get_collision_point()))
|
||||||
request_state_change.call_func('ledge_grab')
|
request_state_change.call_func('ledge_grab')
|
||||||
return
|
|
||||||
if parent.is_on_floor():
|
if parent.is_on_floor():
|
||||||
#modifier.reference()
|
#modifier.reference()
|
||||||
#idle_state.modifier = landing_modifier
|
#idle_state.modifier = landing_modifier
|
||||||
request_state_change.call_func('land')
|
request_state_change.call_func('land')
|
||||||
return
|
|
||||||
|
|
||||||
#move_actor_as_desired()
|
#move_actor_as_desired()
|
||||||
apply_movement_to_parent(
|
apply_movement_to_parent(
|
||||||
|
|
@ -356,7 +327,7 @@ func _state_process_physics_fall():
|
||||||
func _state_process_physics_jump():
|
func _state_process_physics_jump():
|
||||||
|
|
||||||
flip_sprite_to_movement_direction()
|
flip_sprite_to_movement_direction()
|
||||||
|
|
||||||
#Apparently we're instantly landing
|
#Apparently we're instantly landing
|
||||||
# if parent.is_on_floor():
|
# if parent.is_on_floor():
|
||||||
# #modifier.reference()
|
# #modifier.reference()
|
||||||
|
|
@ -364,7 +335,6 @@ func _state_process_physics_jump():
|
||||||
# request_state_change.call_func('idle')
|
# request_state_change.call_func('idle')
|
||||||
if velocity_controller.velocity.y > 0:
|
if velocity_controller.velocity.y > 0:
|
||||||
request_state_change.call_func('fall')
|
request_state_change.call_func('fall')
|
||||||
return
|
|
||||||
desired_movement_vector.y = UP
|
desired_movement_vector.y = UP
|
||||||
#move_actor_as_desired()
|
#move_actor_as_desired()
|
||||||
apply_movement_to_parent(
|
apply_movement_to_parent(
|
||||||
|
|
@ -373,15 +343,6 @@ func _state_process_physics_jump():
|
||||||
apply_state_modifier(current_state.get_movement_parameters()),
|
apply_state_modifier(current_state.get_movement_parameters()),
|
||||||
desired_movement_vector )
|
desired_movement_vector )
|
||||||
)
|
)
|
||||||
|
|
||||||
## Just slightly bump away from ledge we're bumping into
|
|
||||||
if (($"%JumpAdjustorBack".is_colliding() and !$"%JumpAdjustorFront".is_colliding()) or
|
|
||||||
(!$"%JumpAdjustorBack".is_colliding() and $"%JumpAdjustorFront".is_colliding())):
|
|
||||||
if $"%JumpAdjustorBack".is_colliding():
|
|
||||||
parent.global_position.x += sign(parent.transform.x.x)
|
|
||||||
else:
|
|
||||||
parent.global_position.x += sign(parent.transform.x.x * -1)
|
|
||||||
|
|
||||||
|
|
||||||
func _state_process_physics_move():
|
func _state_process_physics_move():
|
||||||
# flip sprite in direction
|
# flip sprite in direction
|
||||||
|
|
@ -389,15 +350,12 @@ func _state_process_physics_move():
|
||||||
|
|
||||||
if _wants_jump:
|
if _wants_jump:
|
||||||
request_state_change.call_func('jump')
|
request_state_change.call_func('jump')
|
||||||
return
|
|
||||||
|
|
||||||
if desired_movement_vector.x == 0:
|
if desired_movement_vector.x == 0:
|
||||||
request_state_change.call_func('idle')
|
request_state_change.call_func('idle')
|
||||||
return
|
|
||||||
|
|
||||||
if !parent.is_on_floor():
|
if !parent.is_on_floor():
|
||||||
request_state_change.call_func('fall')
|
request_state_change.call_func('fall')
|
||||||
return
|
|
||||||
|
|
||||||
## First version
|
## First version
|
||||||
#move_actor_as_desired()
|
#move_actor_as_desired()
|
||||||
|
|
@ -451,35 +409,20 @@ func _state_process_physics_climb():
|
||||||
# animations.stop()
|
# animations.stop()
|
||||||
else:
|
else:
|
||||||
return request_state_change.call_func('idle')
|
return request_state_change.call_func('idle')
|
||||||
|
|
||||||
|
|
||||||
if _wants_crouch:
|
if _wants_crouch:
|
||||||
request_state_change.call_func('fall')
|
request_state_change.call_func('fall')
|
||||||
return
|
|
||||||
|
|
||||||
func _state_process_physics_ledge_grab():
|
func _state_process_physics_ledge_grab():
|
||||||
if debug_component:
|
if debug_component:
|
||||||
UiManager.debug_text = (str(velocity_controller.velocity))
|
UiManager.debug_text = (str(velocity_controller.velocity))
|
||||||
$"%LedgeDetector".set_enabled(false)
|
$"%LedgeDetector".set_enabled(false)
|
||||||
|
|
||||||
var foo = $"%LedgeDetector".is_colliding()
|
|
||||||
var bar = $"%WallDetector".is_colliding()
|
|
||||||
|
|
||||||
if _wants_jump:
|
if _wants_jump:
|
||||||
request_state_change.call_func('ledge_climb')
|
request_state_change.call_func('ledge_climb')
|
||||||
return
|
|
||||||
|
|
||||||
if _wants_crouch:
|
if _wants_crouch:
|
||||||
request_state_change.call_func('fall')
|
request_state_change.call_func('fall')
|
||||||
return
|
|
||||||
|
|
||||||
var move_downward = 0.0
|
|
||||||
if !$"%WallDetector".is_colliding():
|
|
||||||
move_downward = 1.0
|
|
||||||
parent.global_position.y += move_downward
|
|
||||||
|
|
||||||
## Trend towart the ledge
|
|
||||||
parent.move_and_slide(Vector2(sign(parent.transform.x.x) * 1, 0),Vector2.UP)
|
|
||||||
|
|
||||||
func _state_process_physics_ledge_climb():
|
func _state_process_physics_ledge_climb():
|
||||||
# $"../LedgeDetector".set_enabled(false)
|
# $"../LedgeDetector".set_enabled(false)
|
||||||
|
|
@ -513,25 +456,14 @@ func _state_process_physics_crouch():
|
||||||
|
|
||||||
if _wants_crouch != true:
|
if _wants_crouch != true:
|
||||||
request_state_change.call_func('idle')
|
request_state_change.call_func('idle')
|
||||||
return
|
|
||||||
|
|
||||||
if !parent.is_on_floor():
|
if !parent.is_on_floor():
|
||||||
request_state_change.call_func('fall')
|
request_state_change.call_func('fall')
|
||||||
return
|
|
||||||
|
|
||||||
if _wants_crouch == true and desired_movement_vector.x != 0:
|
if _wants_crouch == true and desired_movement_vector.x != 0:
|
||||||
request_state_change.call_func('crouch_move')
|
request_state_change.call_func('crouch_move')
|
||||||
return
|
|
||||||
elif desired_movement_vector.x != 0: # and velocity.x != 0:
|
elif desired_movement_vector.x != 0: # and velocity.x != 0:
|
||||||
request_state_change.call_func('move')
|
request_state_change.call_func('move')
|
||||||
return
|
|
||||||
|
|
||||||
apply_movement_to_parent(
|
|
||||||
velocity_controller.calculate_velocity(
|
|
||||||
physics_delta ,
|
|
||||||
apply_state_modifier(current_state.get_movement_parameters()),
|
|
||||||
desired_movement_vector )
|
|
||||||
)
|
|
||||||
|
|
||||||
func _state_process_physics_crouch_move():
|
func _state_process_physics_crouch_move():
|
||||||
# flip sprite in direction
|
# flip sprite in direction
|
||||||
|
|
@ -539,18 +471,14 @@ func _state_process_physics_crouch_move():
|
||||||
|
|
||||||
if _wants_crouch != true:
|
if _wants_crouch != true:
|
||||||
request_state_change.call_func('idle')
|
request_state_change.call_func('idle')
|
||||||
return
|
|
||||||
|
|
||||||
if !parent.is_on_floor():
|
if !parent.is_on_floor():
|
||||||
request_state_change.call_func('fall')
|
request_state_change.call_func('fall')
|
||||||
return
|
|
||||||
|
|
||||||
if _wants_crouch == true and desired_movement_vector.x == 0:
|
if _wants_crouch == true and desired_movement_vector.x == 0:
|
||||||
request_state_change.call_func('crouch')
|
request_state_change.call_func('crouch')
|
||||||
return
|
|
||||||
elif _wants_crouch != true and desired_movement_vector.x != 0:
|
elif _wants_crouch != true and desired_movement_vector.x != 0:
|
||||||
request_state_change.call_func('move')
|
request_state_change.call_func('move')
|
||||||
return
|
|
||||||
|
|
||||||
#move_actor_as_desired()
|
#move_actor_as_desired()
|
||||||
apply_movement_to_parent(
|
apply_movement_to_parent(
|
||||||
|
|
|
||||||
|
|
@ -71,9 +71,7 @@ func _ready():
|
||||||
movement_component.state_stamina_cost = state_stamina_cost
|
movement_component.state_stamina_cost = state_stamina_cost
|
||||||
|
|
||||||
tired_debuff_modifier.setup('so_tired', StateModifierMovement.SUB_TYPE.NEGATIVE_CONSTRAINT)
|
tired_debuff_modifier.setup('so_tired', StateModifierMovement.SUB_TYPE.NEGATIVE_CONSTRAINT)
|
||||||
tired_debuff_modifier.speed_start = Vector2(-40,0)
|
tired_debuff_modifier.horizontal_speed = -40
|
||||||
tired_debuff_modifier.processing_mode = StateModifierMovement.SUB_TYPE.NEGATIVE_CONSTRAINT
|
|
||||||
#tired_debuff_modifier.horizontal_speed = -40
|
|
||||||
tired_debuff_modifier.only_grounded = true
|
tired_debuff_modifier.only_grounded = true
|
||||||
movement_state_machine.push_state_modifier(tired_debuff_modifier)
|
movement_state_machine.push_state_modifier(tired_debuff_modifier)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,21 +38,15 @@
|
||||||
|
|
||||||
[sub_resource type="Resource" id=3]
|
[sub_resource type="Resource" id=3]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
resource_name = "hurt"
|
|
||||||
script = ExtResource( 18 )
|
script = ExtResource( 18 )
|
||||||
debug_state = false
|
debug_state = false
|
||||||
timeout_seconds = 2.0
|
timeout_seconds = 2.0
|
||||||
name = "hurt"
|
name = "hurt"
|
||||||
speed_start = Vector2( 20, 1.36422e-12 )
|
|
||||||
speed_end = Vector2( 20, 1000 )
|
|
||||||
min_acceleration = Vector2( 0, 0 )
|
|
||||||
acceleration = Vector2( 0, 280 )
|
|
||||||
max_acceleration = Vector2( 0, 0 )
|
|
||||||
jerk_factor = Vector2( 1, 1 )
|
|
||||||
horizontal_speed = 20.0
|
horizontal_speed = 20.0
|
||||||
horizontal_acceleration = 0.0
|
horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
vertical_speed = 0.0
|
||||||
vertical_acceleration = 0.0
|
vertical_acceleration = 0.0
|
||||||
vertical_speed_offset = 0.0
|
vertical_speed_offset = 0.0
|
||||||
|
|
@ -105,7 +99,8 @@ states = [ ExtResource( 4 ), ExtResource( 9 ), ExtResource( 7 ), ExtResource( 8
|
||||||
|
|
||||||
[node name="AnimatedSprite_StateReceiver" parent="." index="1"]
|
[node name="AnimatedSprite_StateReceiver" parent="." index="1"]
|
||||||
frames = ExtResource( 2 )
|
frames = ExtResource( 2 )
|
||||||
animation = "jump"
|
animation = "attack-punch"
|
||||||
|
frame = 7
|
||||||
script = ExtResource( 5 )
|
script = ExtResource( 5 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_aseprite_wizard_config_": {
|
"_aseprite_wizard_config_": {
|
||||||
|
|
@ -123,7 +118,6 @@ __meta__ = {
|
||||||
|
|
||||||
[node name="Movement_StateReceiver" parent="." index="2"]
|
[node name="Movement_StateReceiver" parent="." index="2"]
|
||||||
script = ExtResource( 6 )
|
script = ExtResource( 6 )
|
||||||
debug_velocity_controller = false
|
|
||||||
|
|
||||||
[node name="Modifier_Receiver" parent="." index="3" instance=ExtResource( 35 )]
|
[node name="Modifier_Receiver" parent="." index="3" instance=ExtResource( 35 )]
|
||||||
callable_state_machine = NodePath("../Movement_StateMachine")
|
callable_state_machine = NodePath("../Movement_StateMachine")
|
||||||
|
|
@ -132,9 +126,9 @@ debug_receiver = true
|
||||||
[node name="LedgeDetector" type="RayCast2D" parent="." index="4"]
|
[node name="LedgeDetector" type="RayCast2D" parent="." index="4"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
modulate = Color( 0, 1, 0, 1 )
|
modulate = Color( 0, 1, 0, 1 )
|
||||||
position = Vector2( 6, -10 )
|
position = Vector2( 8, -10 )
|
||||||
enabled = true
|
enabled = true
|
||||||
cast_to = Vector2( 4, -1 )
|
cast_to = Vector2( 1.36422e-12, -1 )
|
||||||
|
|
||||||
[node name="WallDetector" type="RayCast2D" parent="." index="5"]
|
[node name="WallDetector" type="RayCast2D" parent="." index="5"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|
@ -143,21 +137,7 @@ position = Vector2( 6, -16 )
|
||||||
enabled = true
|
enabled = true
|
||||||
cast_to = Vector2( 4, 4 )
|
cast_to = Vector2( 4, 4 )
|
||||||
|
|
||||||
[node name="JumpAdjustorBack" type="RayCast2D" parent="." index="6"]
|
[node name="LadderDetector" type="RayCast2D" parent="." index="6"]
|
||||||
unique_name_in_owner = true
|
|
||||||
modulate = Color( 0, 1, 0, 1 )
|
|
||||||
position = Vector2( -8, -12 )
|
|
||||||
enabled = true
|
|
||||||
cast_to = Vector2( 5, -14 )
|
|
||||||
|
|
||||||
[node name="JumpAdjustorFront" type="RayCast2D" parent="." index="7"]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
modulate = Color( 0, 1, 0, 1 )
|
|
||||||
position = Vector2( 7, -12 )
|
|
||||||
enabled = true
|
|
||||||
cast_to = Vector2( -5, -14 )
|
|
||||||
|
|
||||||
[node name="LadderDetector" type="RayCast2D" parent="." index="8"]
|
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
modulate = Color( 0, 1, 0, 1 )
|
modulate = Color( 0, 1, 0, 1 )
|
||||||
enabled = true
|
enabled = true
|
||||||
|
|
@ -166,25 +146,25 @@ collision_mask = 1024
|
||||||
collide_with_areas = true
|
collide_with_areas = true
|
||||||
collide_with_bodies = false
|
collide_with_bodies = false
|
||||||
|
|
||||||
[node name="AudioStreamPlayer_StateReceiver" parent="." index="9"]
|
[node name="AudioStreamPlayer_StateReceiver" parent="." index="7"]
|
||||||
sound_effects = [ SubResource( 4 ), SubResource( 5 ), SubResource( 6 ) ]
|
sound_effects = [ SubResource( 4 ), SubResource( 5 ), SubResource( 6 ) ]
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="10"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="8"]
|
||||||
position = Vector2( 0, 2 )
|
position = Vector2( 0, 2 )
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
script = ExtResource( 31 )
|
script = ExtResource( 31 )
|
||||||
callable_state_machine = NodePath("../Movement_StateMachine")
|
callable_state_machine = NodePath("../Movement_StateMachine")
|
||||||
|
|
||||||
[node name="Health_Component" parent="." index="11" instance=ExtResource( 17 )]
|
[node name="Health_Component" parent="." index="9" instance=ExtResource( 17 )]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
max_health = 100
|
max_health = 100
|
||||||
|
|
||||||
[node name="Stamina_Component" parent="." index="12" instance=ExtResource( 29 )]
|
[node name="Stamina_Component" parent="." index="10" instance=ExtResource( 29 )]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
max_stamina = 50
|
max_stamina = 50
|
||||||
recovery_rate = 2
|
recovery_rate = 2
|
||||||
|
|
||||||
[node name="Hurtbox_Component" parent="." index="13" instance=ExtResource( 16 )]
|
[node name="Hurtbox_Component" parent="." index="11" instance=ExtResource( 16 )]
|
||||||
collision_layer = 16
|
collision_layer = 16
|
||||||
collision_mask = 128
|
collision_mask = 128
|
||||||
hurtbox_entered_function = "hit_Receiver"
|
hurtbox_entered_function = "hit_Receiver"
|
||||||
|
|
@ -196,13 +176,13 @@ shape = SubResource( 2 )
|
||||||
script = ExtResource( 34 )
|
script = ExtResource( 34 )
|
||||||
callable_state_machine = NodePath("../../Movement_StateMachine")
|
callable_state_machine = NodePath("../../Movement_StateMachine")
|
||||||
|
|
||||||
[node name="Interactable_Receiver" type="Node" parent="." index="14"]
|
[node name="Interactable_Receiver" type="Node" parent="." index="12"]
|
||||||
script = ExtResource( 21 )
|
script = ExtResource( 21 )
|
||||||
interactable_parent_callback = "touch_the_thing"
|
interactable_parent_callback = "touch_the_thing"
|
||||||
|
|
||||||
[node name="PewMachine" parent="." index="15" instance=ExtResource( 28 )]
|
[node name="PewMachine" parent="." index="13" instance=ExtResource( 28 )]
|
||||||
|
|
||||||
[node name="Hitbox_Component" parent="." index="16" instance=ExtResource( 33 )]
|
[node name="Hitbox_Component" parent="." index="14" instance=ExtResource( 33 )]
|
||||||
collision_layer = 192
|
collision_layer = 192
|
||||||
damage_amount = 10
|
damage_amount = 10
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,11 @@ script = ExtResource( 1 )
|
||||||
debug_state = false
|
debug_state = false
|
||||||
timeout_seconds = 0.0
|
timeout_seconds = 0.0
|
||||||
name = "attack_punch"
|
name = "attack_punch"
|
||||||
speed_start = Vector2( 0, 0 )
|
|
||||||
speed_end = Vector2( 0, 1000 )
|
|
||||||
min_acceleration = Vector2( 0, 0 )
|
|
||||||
acceleration = Vector2( 0, 280 )
|
|
||||||
max_acceleration = Vector2( 0, 0 )
|
|
||||||
jerk_factor = Vector2( 1, 1 )
|
|
||||||
horizontal_speed = 1.36422e-12
|
horizontal_speed = 1.36422e-12
|
||||||
horizontal_acceleration = 0.0
|
horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
vertical_speed = 0.0
|
||||||
vertical_acceleration = 0.0
|
vertical_acceleration = 0.0
|
||||||
vertical_speed_offset = 0.0
|
vertical_speed_offset = 0.0
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,11 @@ script = ExtResource( 1 )
|
||||||
debug_state = false
|
debug_state = false
|
||||||
timeout_seconds = 0.0
|
timeout_seconds = 0.0
|
||||||
name = "attack_shoot"
|
name = "attack_shoot"
|
||||||
speed_start = Vector2( 0, 0 )
|
|
||||||
speed_end = Vector2( 0, 1000 )
|
|
||||||
min_acceleration = Vector2( 0, 0 )
|
|
||||||
acceleration = Vector2( 0, 280 )
|
|
||||||
max_acceleration = Vector2( 0, 0 )
|
|
||||||
jerk_factor = Vector2( 1, 1 )
|
|
||||||
horizontal_speed = 1.36422e-12
|
horizontal_speed = 1.36422e-12
|
||||||
horizontal_acceleration = 0.0
|
horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
vertical_speed = 0.0
|
||||||
vertical_acceleration = 0.0
|
vertical_acceleration = 0.0
|
||||||
vertical_speed_offset = 0.0
|
vertical_speed_offset = 0.0
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,11 @@ script = ExtResource( 1 )
|
||||||
debug_state = false
|
debug_state = false
|
||||||
timeout_seconds = 0.0
|
timeout_seconds = 0.0
|
||||||
name = "attack_sword"
|
name = "attack_sword"
|
||||||
speed_start = Vector2( 0, 0 )
|
|
||||||
speed_end = Vector2( 0, 1000 )
|
|
||||||
min_acceleration = Vector2( 0, 0 )
|
|
||||||
acceleration = Vector2( 0, 280 )
|
|
||||||
max_acceleration = Vector2( 0, 0 )
|
|
||||||
jerk_factor = Vector2( 1, 1 )
|
|
||||||
horizontal_speed = 1.36422e-12
|
horizontal_speed = 1.36422e-12
|
||||||
horizontal_acceleration = 0.0
|
horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
vertical_speed = 0.0
|
||||||
vertical_acceleration = 0.0
|
vertical_acceleration = 0.0
|
||||||
vertical_speed_offset = 0.0
|
vertical_speed_offset = 0.0
|
||||||
|
|
|
||||||
|
|
@ -8,16 +8,11 @@ script = ExtResource( 1 )
|
||||||
debug_state = false
|
debug_state = false
|
||||||
timeout_seconds = 0.0
|
timeout_seconds = 0.0
|
||||||
name = "climb"
|
name = "climb"
|
||||||
speed_start = Vector2( 0, 0 )
|
|
||||||
speed_end = Vector2( 0, 1000 )
|
|
||||||
min_acceleration = Vector2( 0, 0 )
|
|
||||||
acceleration = Vector2( 0, 280 )
|
|
||||||
max_acceleration = Vector2( 0, 0 )
|
|
||||||
jerk_factor = Vector2( 1, 1 )
|
|
||||||
horizontal_speed = 20.0
|
horizontal_speed = 20.0
|
||||||
horizontal_acceleration = 0.0
|
horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
vertical_speed = 0.0
|
||||||
vertical_acceleration = 0.0
|
vertical_acceleration = 0.0
|
||||||
vertical_speed_offset = 0.0
|
vertical_speed_offset = 0.0
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,11 @@ script = ExtResource( 1 )
|
||||||
debug_state = false
|
debug_state = false
|
||||||
timeout_seconds = 0.0
|
timeout_seconds = 0.0
|
||||||
name = "crouch"
|
name = "crouch"
|
||||||
speed_start = Vector2( 0, 0 )
|
|
||||||
speed_end = Vector2( 0, 1000 )
|
|
||||||
min_acceleration = Vector2( 0, 0 )
|
|
||||||
acceleration = Vector2( 0, 280 )
|
|
||||||
max_acceleration = Vector2( 0, 0 )
|
|
||||||
jerk_factor = Vector2( 1, 1 )
|
|
||||||
horizontal_speed = 1.36422e-12
|
horizontal_speed = 1.36422e-12
|
||||||
horizontal_acceleration = 0.0
|
horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
vertical_speed = 0.0
|
||||||
vertical_acceleration = 0.0
|
vertical_acceleration = 0.0
|
||||||
vertical_speed_offset = 0.0
|
vertical_speed_offset = 0.0
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,11 @@ script = ExtResource( 1 )
|
||||||
debug_state = false
|
debug_state = false
|
||||||
timeout_seconds = 0.0
|
timeout_seconds = 0.0
|
||||||
name = "crouch_move"
|
name = "crouch_move"
|
||||||
speed_start = Vector2( 60, 1.36422e-12 )
|
|
||||||
speed_end = Vector2( 60, 1000 )
|
|
||||||
min_acceleration = Vector2( 0, 0 )
|
|
||||||
acceleration = Vector2( 0, 280 )
|
|
||||||
max_acceleration = Vector2( 0, 0 )
|
|
||||||
jerk_factor = Vector2( 1, 1 )
|
|
||||||
horizontal_speed = 60.0
|
horizontal_speed = 60.0
|
||||||
horizontal_acceleration = 0.0
|
horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
vertical_speed = 0.0
|
||||||
vertical_acceleration = 0.0
|
vertical_acceleration = 0.0
|
||||||
vertical_speed_offset = 0.0
|
vertical_speed_offset = 0.0
|
||||||
|
|
|
||||||
|
|
@ -9,22 +9,17 @@ script = ExtResource( 1 )
|
||||||
debug_state = false
|
debug_state = false
|
||||||
timeout_seconds = 0.0
|
timeout_seconds = 0.0
|
||||||
name = "death"
|
name = "death"
|
||||||
speed_start = Vector2( 0, 0 )
|
|
||||||
speed_end = Vector2( 0, 1000 )
|
|
||||||
min_acceleration = Vector2( 0, 0 )
|
|
||||||
acceleration = Vector2( 0, 280 )
|
|
||||||
max_acceleration = Vector2( 0, 0 )
|
|
||||||
jerk_factor = Vector2( 1, 1 )
|
|
||||||
horizontal_speed = 1.36422e-12
|
horizontal_speed = 1.36422e-12
|
||||||
horizontal_acceleration = 0.0
|
horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
vertical_speed = 0.0
|
||||||
vertical_acceleration = 0.0
|
vertical_acceleration = 0.0
|
||||||
vertical_speed_offset = 0.0
|
vertical_speed_offset = 0.0
|
||||||
vertical_speed_offset_acceleration = 0.0
|
vertical_speed_offset_acceleration = 0.0
|
||||||
horizontal_jerk_factor = 1.0
|
horizontal_jerk_factor = 1.0
|
||||||
vertical_jerk_factor = 1.0
|
vertical_jerk_factor = 1.0
|
||||||
preserve_inertia = false
|
preserve_inertia = true
|
||||||
is_grounded = true
|
is_grounded = true
|
||||||
animation_sequence = [ "death" ]
|
animation_sequence = [ "death" ]
|
||||||
|
|
|
||||||
|
|
@ -8,22 +8,17 @@ script = ExtResource( 1 )
|
||||||
debug_state = false
|
debug_state = false
|
||||||
timeout_seconds = 1.0
|
timeout_seconds = 1.0
|
||||||
name = "enter_right"
|
name = "enter_right"
|
||||||
speed_start = Vector2( 30, 1.36422e-12 )
|
|
||||||
speed_end = Vector2( 30, 1000 )
|
|
||||||
min_acceleration = Vector2( 0, 0 )
|
|
||||||
acceleration = Vector2( 0, 280 )
|
|
||||||
max_acceleration = Vector2( 0, 0 )
|
|
||||||
jerk_factor = Vector2( 1, 1 )
|
|
||||||
horizontal_speed = 30.0
|
horizontal_speed = 30.0
|
||||||
horizontal_acceleration = 0.0
|
horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
vertical_speed = 0.0
|
||||||
vertical_acceleration = 0.0
|
vertical_acceleration = 0.0
|
||||||
vertical_speed_offset = 0.0
|
vertical_speed_offset = 0.0
|
||||||
vertical_speed_offset_acceleration = 0.0
|
vertical_speed_offset_acceleration = 0.0
|
||||||
horizontal_jerk_factor = 1.0
|
horizontal_jerk_factor = 1.0
|
||||||
vertical_jerk_factor = 1.0
|
vertical_jerk_factor = 1.0
|
||||||
preserve_inertia = false
|
preserve_inertia = true
|
||||||
is_grounded = true
|
is_grounded = true
|
||||||
animation_sequence = [ "walk" ]
|
animation_sequence = [ "walk" ]
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,11 @@ script = ExtResource( 1 )
|
||||||
debug_state = false
|
debug_state = false
|
||||||
timeout_seconds = 0.0
|
timeout_seconds = 0.0
|
||||||
name = "fall"
|
name = "fall"
|
||||||
speed_start = Vector2( 60, 1.36422e-12 )
|
|
||||||
speed_end = Vector2( 60, 1000 )
|
|
||||||
min_acceleration = Vector2( 0, 0 )
|
|
||||||
acceleration = Vector2( 1.36422e-12, 500 )
|
|
||||||
max_acceleration = Vector2( 0, 0 )
|
|
||||||
jerk_factor = Vector2( 1, 1 )
|
|
||||||
horizontal_speed = 90.0
|
horizontal_speed = 90.0
|
||||||
horizontal_acceleration = 0.0
|
horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
|
jerk_factor = 1.0
|
||||||
vertical_speed = 0.0
|
vertical_speed = 0.0
|
||||||
vertical_acceleration = 0.0
|
vertical_acceleration = 0.0
|
||||||
vertical_speed_offset = 0.0
|
vertical_speed_offset = 0.0
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,11 @@ script = ExtResource( 1 )
|
||||||
debug_state = false
|
debug_state = false
|
||||||
timeout_seconds = 0.0
|
timeout_seconds = 0.0
|
||||||
name = "idle"
|
name = "idle"
|
||||||
speed_start = Vector2( 1.36422e-12, 1.36422e-12 )
|
|
||||||
speed_end = Vector2( 0, 1000 )
|
|
||||||
min_acceleration = Vector2( 0, 0 )
|
|
||||||
acceleration = Vector2( 0, 280 )
|
|
||||||
max_acceleration = Vector2( 0, 0 )
|
|
||||||
jerk_factor = Vector2( 1, 1 )
|
|
||||||
horizontal_speed = 1.36422e-12
|
horizontal_speed = 1.36422e-12
|
||||||
horizontal_acceleration = 300.0
|
horizontal_acceleration = 300.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
|
jerk_factor = 1.0
|
||||||
vertical_speed = 0.0
|
vertical_speed = 0.0
|
||||||
vertical_acceleration = 0.0
|
vertical_acceleration = 0.0
|
||||||
vertical_speed_offset = 0.0
|
vertical_speed_offset = 0.0
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,11 @@ script = ExtResource( 1 )
|
||||||
debug_state = false
|
debug_state = false
|
||||||
timeout_seconds = 0.0
|
timeout_seconds = 0.0
|
||||||
name = "jump"
|
name = "jump"
|
||||||
speed_start = Vector2( 90, 200 )
|
|
||||||
speed_end = Vector2( 90, -8 )
|
|
||||||
min_acceleration = Vector2( 0, 0 )
|
|
||||||
acceleration = Vector2( 1.36422e-12, 360 )
|
|
||||||
max_acceleration = Vector2( 0, 0 )
|
|
||||||
jerk_factor = Vector2( 1, 1 )
|
|
||||||
horizontal_speed = 90.0
|
horizontal_speed = 90.0
|
||||||
horizontal_acceleration = 0.0
|
horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
|
jerk_factor = 1.0
|
||||||
vertical_speed = 200.0
|
vertical_speed = 200.0
|
||||||
vertical_acceleration = 0.0
|
vertical_acceleration = 0.0
|
||||||
vertical_speed_offset = -208.0
|
vertical_speed_offset = -208.0
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,11 @@ script = ExtResource( 1 )
|
||||||
debug_state = false
|
debug_state = false
|
||||||
timeout_seconds = 0.0
|
timeout_seconds = 0.0
|
||||||
name = "land"
|
name = "land"
|
||||||
speed_start = Vector2( 20, 1.36422e-12 )
|
|
||||||
speed_end = Vector2( 20, 1000 )
|
|
||||||
min_acceleration = Vector2( 0, 0 )
|
|
||||||
acceleration = Vector2( 0, 280 )
|
|
||||||
max_acceleration = Vector2( 0, 0 )
|
|
||||||
jerk_factor = Vector2( 1, 1 )
|
|
||||||
horizontal_speed = 20.0
|
horizontal_speed = 20.0
|
||||||
horizontal_acceleration = 0.0
|
horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
vertical_speed = 0.0
|
||||||
vertical_acceleration = 0.0
|
vertical_acceleration = 0.0
|
||||||
vertical_speed_offset = 0.0
|
vertical_speed_offset = 0.0
|
||||||
|
|
|
||||||
|
|
@ -9,22 +9,17 @@ script = ExtResource( 1 )
|
||||||
debug_state = false
|
debug_state = false
|
||||||
timeout_seconds = 0.0
|
timeout_seconds = 0.0
|
||||||
name = "ledge_climb"
|
name = "ledge_climb"
|
||||||
speed_start = Vector2( 0, 0 )
|
|
||||||
speed_end = Vector2( 0, 1000 )
|
|
||||||
min_acceleration = Vector2( 0, 0 )
|
|
||||||
acceleration = Vector2( 0, 280 )
|
|
||||||
max_acceleration = Vector2( 0, 0 )
|
|
||||||
jerk_factor = Vector2( 1, 1 )
|
|
||||||
horizontal_speed = 1.36422e-12
|
horizontal_speed = 1.36422e-12
|
||||||
horizontal_acceleration = 0.0
|
horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
vertical_speed = 0.0
|
||||||
vertical_acceleration = 0.0
|
vertical_acceleration = 0.0
|
||||||
vertical_speed_offset = 0.0
|
vertical_speed_offset = 0.0
|
||||||
vertical_speed_offset_acceleration = 0.0
|
vertical_speed_offset_acceleration = 0.0
|
||||||
horizontal_jerk_factor = 1.0
|
horizontal_jerk_factor = 1.0
|
||||||
vertical_jerk_factor = 1.0
|
vertical_jerk_factor = 1.0
|
||||||
preserve_inertia = false
|
preserve_inertia = true
|
||||||
is_grounded = true
|
is_grounded = true
|
||||||
animation_sequence = [ "ledge-climb" ]
|
animation_sequence = [ "ledge-climb" ]
|
||||||
|
|
|
||||||
|
|
@ -9,22 +9,17 @@ script = ExtResource( 1 )
|
||||||
debug_state = false
|
debug_state = false
|
||||||
timeout_seconds = 0.0
|
timeout_seconds = 0.0
|
||||||
name = "ledge_grab"
|
name = "ledge_grab"
|
||||||
speed_start = Vector2( 0, 0 )
|
|
||||||
speed_end = Vector2( 0, 1000 )
|
|
||||||
min_acceleration = Vector2( 0, 0 )
|
|
||||||
acceleration = Vector2( 0, 280 )
|
|
||||||
max_acceleration = Vector2( 0, 0 )
|
|
||||||
jerk_factor = Vector2( 1, 1 )
|
|
||||||
horizontal_speed = 1.36422e-12
|
horizontal_speed = 1.36422e-12
|
||||||
horizontal_acceleration = 0.0
|
horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
vertical_speed = 0.0
|
||||||
vertical_acceleration = 0.0
|
vertical_acceleration = 0.0
|
||||||
vertical_speed_offset = 0.0
|
vertical_speed_offset = 0.0
|
||||||
vertical_speed_offset_acceleration = 0.0
|
vertical_speed_offset_acceleration = 0.0
|
||||||
horizontal_jerk_factor = 1.0
|
horizontal_jerk_factor = 1.0
|
||||||
vertical_jerk_factor = 1.0
|
vertical_jerk_factor = 1.0
|
||||||
preserve_inertia = false
|
preserve_inertia = true
|
||||||
is_grounded = true
|
is_grounded = true
|
||||||
animation_sequence = [ "ledge-grab" ]
|
animation_sequence = [ "ledge-grab" ]
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,11 @@ script = ExtResource( 1 )
|
||||||
debug_state = false
|
debug_state = false
|
||||||
timeout_seconds = 0.0
|
timeout_seconds = 0.0
|
||||||
name = "move"
|
name = "move"
|
||||||
speed_start = Vector2( 60, 1.36422e-12 )
|
|
||||||
speed_end = Vector2( 90, 1000 )
|
|
||||||
min_acceleration = Vector2( 0, 0 )
|
|
||||||
acceleration = Vector2( 200, 280 )
|
|
||||||
max_acceleration = Vector2( 0, 0 )
|
|
||||||
jerk_factor = Vector2( 1, 1 )
|
|
||||||
horizontal_speed = 10.0
|
horizontal_speed = 10.0
|
||||||
horizontal_acceleration = 70.0
|
horizontal_acceleration = 70.0
|
||||||
horizontal_speed_offset = 80.0
|
horizontal_speed_offset = 80.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
vertical_speed = 0.0
|
||||||
vertical_acceleration = 0.0
|
vertical_acceleration = 0.0
|
||||||
vertical_speed_offset = 0.0
|
vertical_speed_offset = 0.0
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,11 @@ script = ExtResource( 1 )
|
||||||
debug_state = false
|
debug_state = false
|
||||||
timeout_seconds = 0.0
|
timeout_seconds = 0.0
|
||||||
name = "roll"
|
name = "roll"
|
||||||
speed_start = Vector2( 150, 1.36422e-12 )
|
|
||||||
speed_end = Vector2( 10, 1000 )
|
|
||||||
min_acceleration = Vector2( 0, 0 )
|
|
||||||
acceleration = Vector2( 300, 280 )
|
|
||||||
max_acceleration = Vector2( 0, 0 )
|
|
||||||
jerk_factor = Vector2( 1, 1 )
|
|
||||||
horizontal_speed = 150.0
|
horizontal_speed = 150.0
|
||||||
horizontal_acceleration = 1.36422e-12
|
horizontal_acceleration = 1.36422e-12
|
||||||
horizontal_speed_offset = -140.0
|
horizontal_speed_offset = -140.0
|
||||||
horizontal_speed_offset_acceleration = -300.0
|
horizontal_speed_offset_acceleration = -300.0
|
||||||
|
jerk_factor = 1.0
|
||||||
vertical_speed = 0.0
|
vertical_speed = 0.0
|
||||||
vertical_acceleration = 0.0
|
vertical_acceleration = 0.0
|
||||||
vertical_speed_offset = 0.0
|
vertical_speed_offset = 0.0
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ extends Area2D
|
||||||
|
|
||||||
export var velocity_pps :float = 1
|
export var velocity_pps :float = 1
|
||||||
export var lifespan :float = -1
|
export var lifespan :float = -1
|
||||||
export var sound_effect :AudioStream
|
|
||||||
var direction_normal := Vector2(0,0)
|
var direction_normal := Vector2(0,0)
|
||||||
puppet var puppet_direction_normal :Vector2
|
puppet var puppet_direction_normal :Vector2
|
||||||
puppet var puppet_position
|
puppet var puppet_position
|
||||||
|
|
|
||||||
|
|
@ -3,26 +3,21 @@ class_name VelocityController
|
||||||
var velocity :Vector2
|
var velocity :Vector2
|
||||||
var debug :bool = false
|
var debug :bool = false
|
||||||
|
|
||||||
const RELATIVE_DIRECTION = 0
|
|
||||||
const POSITIVE_DIRECTION = 1
|
|
||||||
const NEGATIVE_DIRECTION = -1
|
|
||||||
|
|
||||||
enum RANGE_PLACEMENT {
|
enum RANGE_PLACEMENT {
|
||||||
BEFORE_RANGE = -1,
|
BEFORE_RANGE = -1,
|
||||||
WITHIN_RANGE = 0,
|
WITHIN_RANGE = 0,
|
||||||
PAST_RANGE = 1
|
PAST_RANGE = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
enum IMPULSE_PLACEMENT {
|
## Side effects for these variables
|
||||||
LEFT_SIDE,
|
# velocity - doesn't change but uses it to set base calculations
|
||||||
RIGHT_SIDE
|
# accepts the state to determine movement, the deltatime, and an optional direction
|
||||||
}
|
# Update: Actually should just return movement in PPS
|
||||||
|
##
|
||||||
|
|
||||||
## Could these be datatypes or a class? Sure
|
## Could these be datatypes or a class? Sure
|
||||||
var _h_impulse_applied :bool = false
|
var _h_impulse_applied :bool = false
|
||||||
var _h_impulse_speed_tracking :Vector2
|
var _h_impulse_speed_tracking :Vector2
|
||||||
var _h_impulse_placement_tracking :int = -1
|
|
||||||
var _v_impulse_applied :bool = false
|
var _v_impulse_applied :bool = false
|
||||||
var _v_impulse_speed_tracking :Vector2
|
var _v_impulse_speed_tracking :Vector2
|
||||||
|
|
||||||
|
|
@ -47,31 +42,27 @@ func calculate_velocity(_delta :float,
|
||||||
## We're now toing to preserve inertia direction
|
## We're now toing to preserve inertia direction
|
||||||
calc_inertia.x = calc_velocity.x
|
calc_inertia.x = calc_velocity.x
|
||||||
calc_inertia.y = calc_velocity.y
|
calc_inertia.y = calc_velocity.y
|
||||||
|
|
||||||
|
var calc_inertial_dir = Vector2(sign(calc_velocity.x),sign(calc_velocity.y))
|
||||||
|
#var calc_friction :Vector2 = Vector2.ZERO
|
||||||
|
|
||||||
## Determine movement direction
|
## Determine movement direction
|
||||||
# If there is an inertia direction from existing velocity and
|
# If there is an inertia direction from existing velocity and
|
||||||
# no desired movement we'll continue to travel in that direction.
|
# no desired movement we'll continue to travel in that direction.
|
||||||
##
|
##
|
||||||
## If an override has been passed (we're ignoring input direction
|
## If an override has been passed (we're ignoring input direction
|
||||||
##TODO: Should preserve initia apply here
|
|
||||||
var move_direction = Vector2.ZERO
|
var move_direction = Vector2.ZERO
|
||||||
move_direction = resolve_move_direction(calc_inertia, _movement_direction)
|
move_direction = resolve_move_direction(calc_inertia, _movement_direction)
|
||||||
|
# else:
|
||||||
## Acceleration is always postive because we use the current inertia
|
# move_direction = resolve_move_direction(calc_inertia, desired_movement_vector)
|
||||||
## placement to the movement range to determine direction of movement.
|
|
||||||
if sign(move_direction.x) != 0:
|
|
||||||
#calc_acceleration.x = abs(movement_parameters.get_acceleration(0).x)
|
|
||||||
calc_acceleration.x = movement_parameters.get_acceleration().x
|
|
||||||
assert(calc_acceleration.x >= 0, "Negative X Acceleration shouln't happen")
|
|
||||||
if is_zero_approx(calc_acceleration.x):
|
|
||||||
move_direction.x = _movement_direction.x
|
|
||||||
|
|
||||||
if sign(move_direction.y) != 0:
|
#var movement_parameters :MovementParameters = _state.get_movement_parameters()
|
||||||
calc_acceleration.y = movement_parameters.get_acceleration().y
|
# if modifier and modifier.is_active:
|
||||||
assert(calc_acceleration.y >= 0, "Negative Y Acceleration shouln't happen")
|
# if (_state.is_grounded and modifier.only_grounded): # Should we skip
|
||||||
if is_zero_approx(calc_acceleration.y):
|
# modifier_indicator = '*'
|
||||||
move_direction.y = _movement_direction.y
|
# if _state.name == 'jump':
|
||||||
|
# var foo = 2+2 # break
|
||||||
|
# movement_parameters.apply_state_modifier(modifier, move_direction.x)
|
||||||
|
|
||||||
## Inertia only applies if there is a difference between the
|
## Inertia only applies if there is a difference between the
|
||||||
# base move speed and a derived move speed. This makes it so all you
|
# base move speed and a derived move speed. This makes it so all you
|
||||||
|
|
@ -82,158 +73,125 @@ func calculate_velocity(_delta :float,
|
||||||
# is the destination speed.
|
# is the destination speed.
|
||||||
# We move towards h_speed.y at the acceleration rate
|
# We move towards h_speed.y at the acceleration rate
|
||||||
##
|
##
|
||||||
var start_speed :float = (
|
var h_speed = resolve_h_speed(movement_parameters)
|
||||||
(movement_parameters.get_speed_start(RELATIVE_DIRECTION).x * move_direction.x) +
|
var v_speed = resolve_v_speed(movement_parameters)
|
||||||
(movement_parameters.get_speed_start(POSITIVE_DIRECTION).x * POSITIVE_DIRECTION) +
|
## Speed will now be expected to move in the direction of travel
|
||||||
(movement_parameters.get_speed_start(NEGATIVE_DIRECTION).x * NEGATIVE_DIRECTION)
|
h_speed *= move_direction.x
|
||||||
)
|
v_speed *= move_direction.y
|
||||||
var end_speed :float = (
|
|
||||||
(movement_parameters.get_speed_end(RELATIVE_DIRECTION).x * move_direction.x) +
|
|
||||||
(movement_parameters.get_speed_end(POSITIVE_DIRECTION).x * POSITIVE_DIRECTION) +
|
|
||||||
(movement_parameters.get_speed_end(NEGATIVE_DIRECTION).x * NEGATIVE_DIRECTION)
|
|
||||||
)
|
|
||||||
var h_speed = Vector2(start_speed, end_speed)
|
|
||||||
|
|
||||||
start_speed = (
|
|
||||||
(movement_parameters.get_speed_start(RELATIVE_DIRECTION).y * move_direction.y) +
|
|
||||||
(movement_parameters.get_speed_start(POSITIVE_DIRECTION).y * POSITIVE_DIRECTION) +
|
|
||||||
(movement_parameters.get_speed_start(NEGATIVE_DIRECTION).y * NEGATIVE_DIRECTION)
|
|
||||||
)
|
|
||||||
end_speed = (
|
|
||||||
(movement_parameters.get_speed_end(RELATIVE_DIRECTION).y * move_direction.y) +
|
|
||||||
(movement_parameters.get_speed_end(POSITIVE_DIRECTION).y * POSITIVE_DIRECTION) +
|
|
||||||
(movement_parameters.get_speed_end(NEGATIVE_DIRECTION).y * NEGATIVE_DIRECTION)
|
|
||||||
)
|
|
||||||
var v_speed = Vector2(start_speed, end_speed)
|
|
||||||
|
|
||||||
|
|
||||||
## Now determine placement of current velocity to speed range
|
## Now determine placement of current velocity to speed range
|
||||||
var h_range_placement = placement_to_speed_range(calc_velocity.x, h_speed)
|
var h_range_placement = placement_to_speed_range(calc_velocity.x, h_speed)
|
||||||
var v_range_placement = placement_to_speed_range(calc_velocity.y, v_speed)
|
var v_range_placement = placement_to_speed_range(calc_velocity.y, v_speed)
|
||||||
|
|
||||||
## We don't want to be able to scoot our impulse speed to cheat the movement
|
## We don't want to be able to scoot our impulse speed to cheat the movement
|
||||||
# Any non zero speed that goes opposite to our inertial direction
|
# Any non zero speed that goes opposite to our inertial direction
|
||||||
# should only be allowed once.
|
# should only be allowed once.
|
||||||
## Reset the impulse when back in range
|
## Reset the impulse when back in range
|
||||||
# may also want to reset when hspeed is static
|
# may also want to reset when hspeed is static
|
||||||
if _h_impulse_applied == true:
|
if (h_range_placement == RANGE_PLACEMENT.WITHIN_RANGE and
|
||||||
if (h_range_placement == RANGE_PLACEMENT.WITHIN_RANGE):
|
_h_impulse_applied == true ):
|
||||||
_h_impulse_applied = false
|
if debug:
|
||||||
if debug:
|
print("resetting H impulse")
|
||||||
print("Resetting H impulse (Within Range)")
|
_h_impulse_applied = false
|
||||||
elif (calc_inertia.x < h_speed.x and _h_impulse_placement_tracking != IMPULSE_PLACEMENT.LEFT_SIDE or
|
|
||||||
calc_inertia.x >= h_speed.x and _h_impulse_placement_tracking != IMPULSE_PLACEMENT.RIGHT_SIDE):
|
|
||||||
_h_impulse_applied = false
|
|
||||||
if debug:
|
|
||||||
print("Resetting H impulse (Impulse Placement Change)")
|
|
||||||
|
|
||||||
# if (h_range_placement == RANGE_PLACEMENT.WITHIN_RANGE and
|
|
||||||
# _h_impulse_speed_tracking != h_speed):
|
|
||||||
# if debug:
|
|
||||||
# print("Resetting H impulse (Within Range)")
|
|
||||||
# _h_impulse_applied = false
|
|
||||||
# elif(h_range_placement == RANGE_PLACEMENT.BEFORE_RANGE):
|
|
||||||
# if debug:
|
|
||||||
# print("Resetting H impulse (Before Range) ", _h_impulse_speed_tracking )
|
|
||||||
|
|
||||||
if (v_range_placement == RANGE_PLACEMENT.WITHIN_RANGE and
|
if (v_range_placement == RANGE_PLACEMENT.WITHIN_RANGE and
|
||||||
_v_impulse_applied == true and
|
_v_impulse_applied == true ):
|
||||||
_v_impulse_speed_tracking != v_speed):
|
|
||||||
if debug:
|
if debug:
|
||||||
print("resetting V impulse")
|
print("resetting V impulse")
|
||||||
_v_impulse_applied = false
|
_v_impulse_applied = false
|
||||||
|
|
||||||
## Separate impulse function
|
## Acceleration is always postive because we use the
|
||||||
if _h_impulse_applied == false and is_zero_approx(h_speed.x) == false:# and _h_impulse_speed_tracking != h_speed:
|
# move toward functions.
|
||||||
#(range_placement :int, inertia :float, impulse_speed_range :Vector2)
|
calc_acceleration.x = abs(resolve_h_acceleration(movement_parameters, move_direction.x))
|
||||||
#_h_impulse_speed_tracking = apply_impulse(h_range_placement, calc_inertia.x, h_speed )
|
|
||||||
var impulse_inertia = apply_impulse(h_range_placement, _h_impulse_speed_tracking , h_speed )
|
|
||||||
if h_range_placement == RANGE_PLACEMENT.PAST_RANGE and abs(h_speed.x) > abs(h_speed.y):
|
|
||||||
if debug:
|
|
||||||
print("Applying H impulse (Past Range): Imp: ", impulse_inertia, ", In:", calc_inertia.x)
|
|
||||||
_h_impulse_speed_tracking = h_speed
|
|
||||||
_h_impulse_applied = true
|
|
||||||
## This might not make sense
|
|
||||||
if (calc_inertia.x + h_speed.x) < h_speed.x:
|
|
||||||
_h_impulse_placement_tracking = IMPULSE_PLACEMENT.LEFT_SIDE
|
|
||||||
else:
|
|
||||||
_h_impulse_placement_tracking = IMPULSE_PLACEMENT.RIGHT_SIDE
|
|
||||||
## We don't blow past the acceleration
|
|
||||||
calc_inertia.x = h_speed.x
|
|
||||||
elif h_range_placement == RANGE_PLACEMENT.BEFORE_RANGE:
|
|
||||||
if debug:
|
|
||||||
print("Applying H impulse (Before Range): Imp: ", impulse_inertia, ", In:", calc_inertia.x)
|
|
||||||
_h_impulse_speed_tracking = h_speed
|
|
||||||
_h_impulse_applied = true
|
|
||||||
if calc_inertia.x < h_speed.x:
|
|
||||||
_h_impulse_placement_tracking = IMPULSE_PLACEMENT.LEFT_SIDE
|
|
||||||
else:
|
|
||||||
_h_impulse_placement_tracking = IMPULSE_PLACEMENT.RIGHT_SIDE
|
|
||||||
if sign(h_speed.x) == sign(h_speed.y):
|
|
||||||
calc_inertia.x += h_speed.x
|
|
||||||
else:
|
|
||||||
##TODO: Maybe this should be something else
|
|
||||||
calc_inertia.x = 0
|
|
||||||
|
|
||||||
## F this, didn't work well
|
|
||||||
# if impulse_inertia != calc_inertia.x: ## We have an impulse to apply
|
|
||||||
# if debug:
|
|
||||||
# print("Applying H impulse: Imp: ", impulse_inertia, ", In:", calc_inertia.x)
|
|
||||||
# #var foo = 2+2
|
|
||||||
# _h_impulse_speed_tracking = h_speed
|
|
||||||
# _h_impulse_applied = true
|
|
||||||
# ## We want to add impulse in the direction of movement so we need to determine
|
|
||||||
# ## what that is.
|
|
||||||
# calc_inertia.x += impulse_inertia
|
|
||||||
|
|
||||||
if _v_impulse_applied == false:# and _v_impulse_speed_tracking != v_speed:
|
|
||||||
var impulse_inertia = apply_impulse(v_range_placement, _v_impulse_speed_tracking, v_speed)
|
|
||||||
if impulse_inertia != calc_inertia.y:
|
|
||||||
_v_impulse_speed_tracking = v_speed
|
|
||||||
_v_impulse_applied = true
|
|
||||||
calc_inertia.y += impulse_inertia
|
|
||||||
|
|
||||||
if debug and movement_parameters.debug_name == 'roll':
|
if debug and movement_parameters.debug_name == 'roll':
|
||||||
var foo = 2+2
|
var foo = 2+2
|
||||||
## We are always moving from h_speed.x towards y at a given rate
|
## We are always moving from h_speed.x towards y at a given rate
|
||||||
## if we have a difference of speed and an acceleration
|
## if we have a difference of speed and an acceleration
|
||||||
if is_zero_approx(calc_acceleration.x) == false:
|
##TODO: The Min Max could be augmented to just be h_speed.x and prevent the sliding.
|
||||||
calc_inertia.x = resolve_inertia(
|
if h_speed.x != h_speed.y and calc_acceleration.x != 0.0:
|
||||||
h_range_placement,
|
var direction_accel :float = calc_acceleration.x * _delta #* move_direction.x
|
||||||
calc_inertia.x ,
|
if h_speed.x > h_speed.y:
|
||||||
h_speed,
|
direction_accel *= -1
|
||||||
(calc_acceleration.x * _delta)
|
match h_range_placement:
|
||||||
)
|
RANGE_PLACEMENT.BEFORE_RANGE:
|
||||||
else:
|
## Also apply impulse here
|
||||||
## Using static move directions insteead of inertial move directions
|
if _h_impulse_applied == false:
|
||||||
# if is_zero_approx(_movement_direction.x) == false:
|
calc_inertia.x += h_speed.x
|
||||||
# calc_inertia.x = h_speed.x
|
_h_impulse_applied = true
|
||||||
# else:
|
#impulse_applied_dir = move_direction.x
|
||||||
# calc_inertia.x = 0.0
|
calc_inertia.x = clamp(calc_inertia.x + direction_accel,
|
||||||
calc_inertia.x = h_speed.x
|
min(calc_inertia.x, h_speed.y),
|
||||||
if debug and movement_parameters.debug_name == 'jump':
|
max(calc_inertia.x, h_speed.y))
|
||||||
var foo = 2+2
|
RANGE_PLACEMENT.WITHIN_RANGE:
|
||||||
|
## If we're within the range but our speed has just changed
|
||||||
|
if _h_impulse_applied == false and _h_impulse_speed_tracking != h_speed:
|
||||||
|
## Set inertia to starting speed, we're already in range
|
||||||
|
calc_inertia.x = h_speed.x
|
||||||
|
_h_impulse_applied = true
|
||||||
|
calc_inertia.x = clamp(calc_inertia.x + direction_accel,
|
||||||
|
min(h_speed.x, h_speed.y),
|
||||||
|
max(h_speed.x, h_speed.y))
|
||||||
|
RANGE_PLACEMENT.PAST_RANGE:
|
||||||
|
if _h_impulse_applied == false and abs(h_speed.x) > abs(h_speed.y):
|
||||||
|
calc_inertia.x = h_speed.x
|
||||||
|
_h_impulse_applied = true
|
||||||
|
calc_inertia.x = clamp(calc_inertia.x - direction_accel, # Friction
|
||||||
|
min(calc_inertia.x, h_speed.y),
|
||||||
|
max(calc_inertia.x, h_speed.y))
|
||||||
|
|
||||||
if is_zero_approx(calc_acceleration.y) == false:
|
|
||||||
calc_inertia.y = resolve_inertia(
|
elif calc_inertia.x != 0.0 and calc_acceleration.x != 0.0: ## We still have inertia but no difference in movement
|
||||||
v_range_placement,
|
if h_speed.x < h_speed.y:
|
||||||
calc_inertia.y ,
|
h_speed.x = clamp(h_speed.x,0.0,h_speed.y)
|
||||||
v_speed,
|
|
||||||
(calc_acceleration.y * _delta)
|
## Move back towards the base speed
|
||||||
)
|
calc_inertia.x = move_toward(calc_inertia.x, h_speed.x, calc_acceleration.x * _delta)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
## Using static move directions insteead of inertial move directions
|
## inertia is just base speed
|
||||||
# if is_zero_approx(_movement_direction.y) == false:
|
calc_inertia.x = h_speed.x
|
||||||
# calc_inertia.y = v_speed.x
|
calc_inertial_dir.x = 0.0 # sign(calc_inertia.x)
|
||||||
calc_inertia.y = v_speed.x
|
|
||||||
|
## Another idea, just return the calculated velocity in PPS
|
||||||
|
## For now, y component of velocity is just gravity
|
||||||
|
if v_speed.x != v_speed.y: ## For now gravity is just the default acceleration
|
||||||
|
var direction_accel :float = movement_parameters.gravity * _delta #* move_direction.x
|
||||||
|
if v_speed.x > v_speed.y:
|
||||||
|
direction_accel *= -1
|
||||||
|
match v_range_placement:
|
||||||
|
RANGE_PLACEMENT.BEFORE_RANGE:
|
||||||
|
## Also apply impulse here
|
||||||
|
if _v_impulse_applied == false:
|
||||||
|
calc_inertia.y += v_speed.x
|
||||||
|
_v_impulse_applied = true
|
||||||
|
#impulse_applied_dir = move_direction.x
|
||||||
|
calc_inertia.y = clamp(calc_inertia.y + direction_accel,
|
||||||
|
min(calc_inertia.x, v_speed.y),
|
||||||
|
max(calc_inertia.x, v_speed.y))
|
||||||
|
RANGE_PLACEMENT.WITHIN_RANGE:
|
||||||
|
## If we're within the range but our speed has just changed
|
||||||
|
if _v_impulse_applied == false and _v_impulse_speed_tracking != v_speed:
|
||||||
|
## Set inertia to starting speed, we're already in range
|
||||||
|
calc_inertia.y = v_speed.x
|
||||||
|
_v_impulse_applied = true
|
||||||
|
calc_inertia.y = clamp(calc_inertia.y + direction_accel,
|
||||||
|
min(v_speed.x, v_speed.y),
|
||||||
|
max(v_speed.x, v_speed.y))
|
||||||
|
RANGE_PLACEMENT.PAST_RANGE:
|
||||||
|
calc_inertia.y = clamp(calc_inertia.y - direction_accel, # Friction
|
||||||
|
min(calc_inertia.y, v_speed.y),
|
||||||
|
max(calc_inertia.y, v_speed.y))
|
||||||
|
|
||||||
|
else:
|
||||||
|
## The previous vertical movement methods
|
||||||
|
calc_inertia.y += movement_parameters.gravity * _delta
|
||||||
|
|
||||||
## Track or last speed for in range impulses
|
## Track or last speed for in range impulses
|
||||||
# _h_impulse_speed_tracking = h_speed
|
_h_impulse_speed_tracking = h_speed
|
||||||
# _v_impulse_speed_tracking = v_speed
|
_v_impulse_speed_tracking = v_speed
|
||||||
|
|
||||||
#calc_velocity.y = calc_inertia.y
|
calc_velocity.y = calc_inertia.y
|
||||||
#calc_velocity.x = calc_inertia.x
|
calc_velocity.x = calc_inertia.x
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
UiManager.debug_text = ( #"H_Speed x Dir: " + str(h_speed) + str('duh') +
|
UiManager.debug_text = ( #"H_Speed x Dir: " + str(h_speed) + str('duh') +
|
||||||
|
|
@ -250,7 +208,7 @@ func calculate_velocity(_delta :float,
|
||||||
"\nMoveDir: {0}, {1}".format({"0":"%4.1f" % move_direction.x, "1":"%4.1f" % move_direction.y})
|
"\nMoveDir: {0}, {1}".format({"0":"%4.1f" % move_direction.x, "1":"%4.1f" % move_direction.y})
|
||||||
)
|
)
|
||||||
|
|
||||||
return calc_inertia
|
return calc_velocity
|
||||||
|
|
||||||
func is_out_of_range(value: float, a: float, b: float) -> bool:
|
func is_out_of_range(value: float, a: float, b: float) -> bool:
|
||||||
var lower = min(a, b)
|
var lower = min(a, b)
|
||||||
|
|
@ -266,21 +224,17 @@ func placement_to_speed_range(speed: float, speed_range: Vector2) -> int:
|
||||||
#var range_start :float = min(speed_range.x, speed_range.y)
|
#var range_start :float = min(speed_range.x, speed_range.y)
|
||||||
#var range_end :float = max(speed_range.x, speed_range.y)
|
#var range_end :float = max(speed_range.x, speed_range.y)
|
||||||
|
|
||||||
##TODO: Do I also need an equivalent
|
|
||||||
|
|
||||||
if is_equal_approx(speed, speed_range.x) or is_equal_approx(speed, speed_range.y):
|
|
||||||
return RANGE_PLACEMENT.WITHIN_RANGE
|
|
||||||
## We can be at the base range to ensure impulse can happen
|
## We can be at the base range to ensure impulse can happen
|
||||||
## Direction <-- that way
|
## Direction <-- that way
|
||||||
if speed_range.x > speed_range.y:
|
if speed_range.x > speed_range.y:
|
||||||
if speed < speed_range.x and speed > speed_range.y:
|
if speed < speed_range.x and speed >= speed_range.y:
|
||||||
return RANGE_PLACEMENT.WITHIN_RANGE
|
return RANGE_PLACEMENT.WITHIN_RANGE
|
||||||
elif speed < speed_range.y:
|
elif speed < speed_range.y:
|
||||||
return RANGE_PLACEMENT.PAST_RANGE
|
return RANGE_PLACEMENT.PAST_RANGE
|
||||||
else:
|
else:
|
||||||
return RANGE_PLACEMENT.BEFORE_RANGE
|
return RANGE_PLACEMENT.BEFORE_RANGE
|
||||||
else: ## Direction --> that way
|
else: ## Direction --> that way
|
||||||
if speed > speed_range.x and speed < speed_range.y:
|
if speed > speed_range.x and speed <= speed_range.y:
|
||||||
return RANGE_PLACEMENT.WITHIN_RANGE
|
return RANGE_PLACEMENT.WITHIN_RANGE
|
||||||
elif speed > speed_range.y:
|
elif speed > speed_range.y:
|
||||||
return RANGE_PLACEMENT.PAST_RANGE
|
return RANGE_PLACEMENT.PAST_RANGE
|
||||||
|
|
@ -288,6 +242,54 @@ func placement_to_speed_range(speed: float, speed_range: Vector2) -> int:
|
||||||
return RANGE_PLACEMENT.BEFORE_RANGE
|
return RANGE_PLACEMENT.BEFORE_RANGE
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
## Returns an Vector where x is MIN_SPEED and y is MAX_SPEED
|
||||||
|
func resolve_h_speed(_params :MovementParameters) -> Vector2:
|
||||||
|
var base_speed :float = _params.base_move_speed.x
|
||||||
|
## if a speed difference applies
|
||||||
|
if _params.move_speed_modifier.x != 0:
|
||||||
|
var speed_differance = base_speed + _params.move_speed_modifier.x
|
||||||
|
|
||||||
|
return(Vector2(base_speed, speed_differance))
|
||||||
|
return Vector2(base_speed,base_speed)
|
||||||
|
|
||||||
|
func resolve_v_speed(_params :MovementParameters) -> Vector2:
|
||||||
|
var base_speed :float = _params.base_move_speed.y
|
||||||
|
## if a speed difference applies
|
||||||
|
if _params.move_speed_modifier.y != 0:
|
||||||
|
var speed_differance = base_speed + _params.move_speed_modifier.y
|
||||||
|
|
||||||
|
return(Vector2(base_speed, speed_differance))
|
||||||
|
return Vector2(base_speed,base_speed)
|
||||||
|
|
||||||
|
func resolve_h_acceleration(_params :MovementParameters, _move_direction :float) -> float:
|
||||||
|
## TODO: Adjust for jerk, determine if we're currently experiencing accel
|
||||||
|
## if a speed difference applies
|
||||||
|
var _acceleration :float = 0.0
|
||||||
|
var base_speed :float = _params.base_move_speed.x
|
||||||
|
if _params.move_speed_modifier.x != 0:
|
||||||
|
var speed_differance = base_speed + _params.move_speed_modifier.x
|
||||||
|
_acceleration = _params.base_move_acceleration.x + _params.move_speed_modifier_acceleration.x
|
||||||
|
##WIP: Add part where offset acceleration only applies until the inertia equals the offset or whatever
|
||||||
|
# if sign(_params["_base_h_move_modifier_move_acceleration"]) == -1 and abs(_inertia.x) >= speed_differance:
|
||||||
|
# #print("I should add the modifier acceleration maybe?")
|
||||||
|
# _acceleration += _params["_base_h_move_modifier_move_acceleration"]
|
||||||
|
# else:
|
||||||
|
# print ("not yet.")
|
||||||
|
else:
|
||||||
|
_acceleration = _params.base_move_acceleration.x
|
||||||
|
|
||||||
|
## This works but I want to try something differant.
|
||||||
|
# if _inertia.x != 0.0 and sign(_inertia.x) != sign(_move_direction):
|
||||||
|
# return _acceleration * -1
|
||||||
|
# elif sign(_move_direction) != 0:
|
||||||
|
# ## If no velocity or it matches just return as is.
|
||||||
|
# return _acceleration
|
||||||
|
|
||||||
|
if sign(_move_direction) != 0:
|
||||||
|
return _acceleration
|
||||||
|
|
||||||
|
# No accel returned unless intended
|
||||||
|
return 0.0
|
||||||
|
|
||||||
func resolve_move_direction(_momentum :Vector2,
|
func resolve_move_direction(_momentum :Vector2,
|
||||||
_movement_direction :Vector2) -> Vector2:
|
_movement_direction :Vector2) -> Vector2:
|
||||||
|
|
@ -304,79 +306,3 @@ func resolve_move_direction(_momentum :Vector2,
|
||||||
vertical_movement_direction = sign(_momentum.y)
|
vertical_movement_direction = sign(_momentum.y)
|
||||||
|
|
||||||
return Vector2(horizontal_movement_direction, vertical_movement_direction)
|
return Vector2(horizontal_movement_direction, vertical_movement_direction)
|
||||||
|
|
||||||
func apply_impulse(range_placement :int, tracking_range :Vector2, impulse_speed_range :Vector2) -> float:
|
|
||||||
match range_placement:
|
|
||||||
RANGE_PLACEMENT.BEFORE_RANGE:
|
|
||||||
# inertia += impulse_speed_range.x
|
|
||||||
# return inertia
|
|
||||||
return impulse_speed_range.x
|
|
||||||
RANGE_PLACEMENT.WITHIN_RANGE:
|
|
||||||
var track_stuff = placement_to_speed_range(tracking_range.x, impulse_speed_range)
|
|
||||||
if tracking_range != impulse_speed_range:
|
|
||||||
## Set inertia to starting speed, we're already in range
|
|
||||||
return impulse_speed_range.x
|
|
||||||
RANGE_PLACEMENT.PAST_RANGE:
|
|
||||||
## If this is a reduced speed move otherwise we usually want to slow down
|
|
||||||
## because we're past the range
|
|
||||||
if abs(impulse_speed_range.x) > abs(impulse_speed_range.y):
|
|
||||||
# inertia = impulse_speed_range.x
|
|
||||||
# return inertia
|
|
||||||
return impulse_speed_range.x
|
|
||||||
return 0.0
|
|
||||||
|
|
||||||
func resolve_inertia(range_placement :int,
|
|
||||||
inertia :float ,
|
|
||||||
speed_range :Vector2, delta_acceleration :float) -> float:
|
|
||||||
|
|
||||||
if speed_range.x != speed_range.y and is_zero_approx(delta_acceleration) == false:
|
|
||||||
var direction_accel :float = delta_acceleration #* move_direction.x
|
|
||||||
if speed_range.x > speed_range.y:
|
|
||||||
direction_accel *= -1
|
|
||||||
match range_placement:
|
|
||||||
RANGE_PLACEMENT.BEFORE_RANGE:
|
|
||||||
## Also apply impulse here
|
|
||||||
# if _h_impulse_applied == false:
|
|
||||||
# inertia += speed_range.x
|
|
||||||
# _h_impulse_applied = true
|
|
||||||
#impulse_applied_dir = move_direction.x
|
|
||||||
inertia = clamp(inertia + direction_accel,
|
|
||||||
min(inertia, speed_range.y),
|
|
||||||
max(inertia, speed_range.y))
|
|
||||||
RANGE_PLACEMENT.WITHIN_RANGE:
|
|
||||||
## If we're within the range but our speed has just changed
|
|
||||||
# if _h_impulse_applied == false and _h_impulse_speed_tracking != h_speed:
|
|
||||||
# ## Set inertia to starting speed, we're already in range
|
|
||||||
# calc_inertia.x = h_speed.x
|
|
||||||
# _h_impulse_applied = true
|
|
||||||
inertia = clamp(inertia + direction_accel,
|
|
||||||
min(inertia, speed_range.y),
|
|
||||||
max(inertia, speed_range.y))
|
|
||||||
RANGE_PLACEMENT.PAST_RANGE:
|
|
||||||
# if _h_impulse_applied == false and abs(speed_range.x) > abs(speed_range.y):
|
|
||||||
# inertia = speed_range.x
|
|
||||||
# _h_impulse_applied = true
|
|
||||||
inertia = clamp(inertia - direction_accel, # Friction
|
|
||||||
min(inertia, speed_range.y),
|
|
||||||
max(inertia, speed_range.y))
|
|
||||||
|
|
||||||
|
|
||||||
elif is_zero_approx(inertia) == false: ## We still have inertia but no difference in movement
|
|
||||||
var clamped_speed = speed_range.x
|
|
||||||
if speed_range.x < speed_range.y:
|
|
||||||
clamped_speed = clamp(speed_range.x,0.0,speed_range.y)
|
|
||||||
|
|
||||||
## Move back towards the base speed
|
|
||||||
inertia = move_toward(inertia, clamped_speed, delta_acceleration)
|
|
||||||
##TODO: This hopefully won't happen (the commented else statement) but I wonder
|
|
||||||
## if I should do anyting here now.
|
|
||||||
# else:
|
|
||||||
# ## inertia is just base speed
|
|
||||||
# inertia = speed_range.x
|
|
||||||
# if debug and speed_range.x == -90:
|
|
||||||
# var foo = 2+2
|
|
||||||
|
|
||||||
return inertia
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,10 +62,8 @@ func shoot(direction = 1):
|
||||||
|
|
||||||
bullet.set_as_toplevel(true)
|
bullet.set_as_toplevel(true)
|
||||||
add_child(bullet)
|
add_child(bullet)
|
||||||
|
|
||||||
# sound_shoot.play()
|
# sound_shoot.play()
|
||||||
timer.start()
|
timer.start()
|
||||||
SoundEffectManager.play_sound(bullet.sound_effect)
|
|
||||||
|
|
||||||
NetworkManager.instance_on_peer_players(loaded_scene, self.get_path(), global_position , true)
|
NetworkManager.instance_on_peer_players(loaded_scene, self.get_path(), global_position , true)
|
||||||
return true
|
return true
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,17 @@
|
||||||
[gd_scene load_steps=6 format=2]
|
[gd_scene load_steps=9 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/templates/level_templates/LevelTemplate.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://src/templates/level_templates/LevelTemplate.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://assets/levels/LegacyFantasy-High_Forest/tileset.tres" type="TileSet" id=2]
|
[ext_resource path="res://assets/levels/LegacyFantasy-High_Forest/tileset.tres" type="TileSet" id=2]
|
||||||
[ext_resource path="res://src/Interactables/LevelTransition.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://src/Interactables/LevelTransition.tscn" type="PackedScene" id=4]
|
||||||
|
[ext_resource path="res://src/Interactables/modifiers/icy_surface.tres" type="Resource" id=5]
|
||||||
|
[ext_resource path="res://lib/components/Modifier_Component.tscn" type="PackedScene" id=6]
|
||||||
[ext_resource path="res://assets/Fonts/default_font.tres" type="Theme" id=7]
|
[ext_resource path="res://assets/Fonts/default_font.tres" type="Theme" id=7]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=2]
|
[sub_resource type="RectangleShape2D" id=2]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id=3]
|
||||||
|
extents = Vector2( 149, 3 )
|
||||||
|
|
||||||
[node name="CloneBox" groups=["world"] instance=ExtResource( 1 )]
|
[node name="CloneBox" groups=["world"] instance=ExtResource( 1 )]
|
||||||
|
|
||||||
[node name="TileMap Background" parent="." index="0"]
|
[node name="TileMap Background" parent="." index="0"]
|
||||||
|
|
@ -14,7 +19,7 @@ z_index = -2
|
||||||
|
|
||||||
[node name="TileMap Collision" parent="." index="1"]
|
[node name="TileMap Collision" parent="." index="1"]
|
||||||
tile_set = ExtResource( 2 )
|
tile_set = ExtResource( 2 )
|
||||||
tile_data = PoolIntArray( -262145, 4, 65536, -327661, 4, 65536, -196609, 4, 65536, -262125, 4, 65536, -131073, 4, 0, -196589, 4, 65536, -65537, 4, 0, -131053, 4, 65536, -1, 4, 0, -65517, 4, 65536, 65533, 4, 0, 65534, 4, 0, 65535, 4, 0, 19, 4, 0, 20, 4, 65536, 21, 4, 65536, 22, 4, 65536, 131069, 4, 0, 65558, 4, 65536, 196605, 4, 0, 131094, 4, 65536, 262141, 4, 0, 196609, 2, 1, 196610, 2, 2, 196625, 2, 0, 196626, 2, 1, 196630, 4, 65536, 327677, 4, 0, 327678, 4, 0, 327679, 4, 0, 262144, 4, 65536, 262145, 2, 65537, 262146, 2, 65538, 262161, 2, 65536, 262162, 2, 65537, 262163, 4, 65536, 262164, 4, 65536, 262165, 4, 65536, 262166, 4, 65536, 327680, 4, 65536, 327699, 4, 65536, 393216, 4, 65536, 393232, 4, 65536, 393233, 4, 65536, 393234, 4, 65536, 393235, 4, 65536, 458752, 4, 65536, 458768, 4, 65536, 458769, 4, 65536, 458770, 4, 65536, 458771, 4, 65536, 589823, 0, 1, 524288, 4, 131072, 524289, 0, 3, 524290, 0, 1, 524291, 0, 2, 524292, 0, 3, 524293, 0, 1, 524294, 0, 2, 524295, 0, 3, 524296, 0, 1, 524297, 0, 2, 524298, 0, 3, 524299, 0, 1, 524300, 0, 2, 524301, 0, 3, 524302, 0, 1, 524303, 0, 2, 524304, 4, 65536, 524305, 4, 65536, 524306, 4, 65536, 524307, 4, 0, 524308, 0, 1, 524309, 0, 2, 524310, 0, 3, 655359, 0, 65537, 589824, 0, 65538, 589825, 0, 65539, 589826, 0, 65537, 589827, 0, 65538, 589828, 0, 65539, 589829, 0, 65537, 589830, 0, 65538, 589831, 0, 65539, 589832, 0, 65537, 589833, 0, 65538, 589834, 0, 65539, 589835, 0, 65537, 589836, 0, 65538, 589837, 0, 65539, 589838, 0, 65537, 589839, 0, 65538, 589840, 0, 65539, 589841, 0, 65537, 589842, 0, 65538, 589843, 0, 65539, 589844, 0, 65537, 589845, 0, 65538, 589846, 0, 65539, 720895, 0, 131073, 655360, 0, 131074, 655361, 0, 131075, 655362, 0, 131073, 655363, 0, 131074, 655364, 0, 131075, 655365, 0, 131073, 655366, 0, 131074, 655367, 0, 131075, 655368, 0, 131073, 655369, 0, 131074, 655370, 0, 131075, 655371, 0, 131073, 655372, 0, 131074, 655373, 0, 131075, 655374, 0, 131073, 655375, 0, 131074, 655376, 0, 131075, 655377, 0, 131073, 655378, 0, 131074, 655379, 0, 131075, 655380, 0, 131073, 655381, 0, 131074, 655382, 0, 131075, 786431, 0, 196609, 720896, 0, 196610, 720897, 0, 196611, 720898, 0, 196609, 720899, 0, 196610, 720900, 0, 196611, 720901, 0, 196609, 720902, 0, 196610, 720903, 0, 196611, 720904, 0, 196609, 720905, 0, 196610, 720906, 0, 196611, 720907, 0, 196609, 720908, 0, 196610, 720909, 0, 196611, 720910, 0, 196609, 720911, 0, 196610, 720912, 0, 196611, 720913, 0, 196609, 720914, 0, 196610, 720915, 0, 196611, 720916, 0, 196609, 720917, 0, 196610, 720918, 0, 196611, 851967, 0, 262145, 786432, 0, 262146, 786433, 0, 262147, 786434, 0, 262145, 786435, 0, 262146, 786436, 0, 262147, 786437, 0, 262145, 786438, 0, 262146, 786439, 0, 262147, 786440, 0, 262145, 786441, 0, 262146, 786442, 0, 262147, 786443, 0, 262145, 786444, 0, 262146, 786445, 0, 262147, 786446, 0, 262145, 786447, 0, 262146, 786448, 0, 262147, 786449, 0, 262145, 786450, 0, 262146, 786451, 0, 262147, 786452, 0, 262145, 786453, 0, 262146, 786454, 0, 262147 )
|
tile_data = PoolIntArray( -196609, 4, 0, -262125, 4, 65536, -131073, 4, 0, -196589, 4, 65536, -65537, 4, 0, -131053, 4, 65536, -3, 4, 0, -2, 4, 0, -1, 4, 0, -65517, 4, 0, -65516, 4, 65536, -65515, 4, 65536, -65514, 4, 65536, 65533, 4, 0, 22, 4, 65536, 131069, 4, 0, 65558, 4, 65536, 196605, 4, 0, 131073, 2, 1, 131074, 2, 2, 131089, 2, 0, 131090, 2, 1, 131094, 4, 65536, 262141, 4, 0, 262142, 4, 0, 262143, 4, 0, 196608, 4, 65536, 196609, 2, 65537, 196610, 2, 65538, 196625, 2, 65536, 196626, 2, 65537, 196627, 4, 65536, 196628, 4, 65536, 196629, 4, 65536, 196630, 4, 65536, 262144, 4, 0, 262163, 4, 0, 327680, 4, 65536, 327699, 4, 65536, 393216, 4, 65536, 393235, 4, 65536, 458752, 4, 65536, 458771, 4, 65536, 589823, 0, 1, 524288, 4, 131072, 524289, 0, 3, 524290, 0, 1, 524291, 0, 2, 524292, 0, 3, 524293, 0, 1, 524294, 0, 2, 524295, 0, 3, 524296, 0, 1, 524297, 0, 2, 524298, 0, 3, 524299, 0, 1, 524300, 0, 2, 524301, 0, 3, 524302, 0, 1, 524303, 0, 2, 524304, 0, 3, 524305, 0, 1, 524306, 0, 2, 524307, 4, 0, 524308, 0, 1, 524309, 0, 2, 524310, 0, 3, 655359, 0, 65537, 589824, 0, 65538, 589825, 0, 65539, 589826, 0, 65537, 589827, 0, 65538, 589828, 0, 65539, 589829, 0, 65537, 589830, 0, 65538, 589831, 0, 65539, 589832, 0, 65537, 589833, 0, 65538, 589834, 0, 65539, 589835, 0, 65537, 589836, 0, 65538, 589837, 0, 65539, 589838, 0, 65537, 589839, 0, 65538, 589840, 0, 65539, 589841, 0, 65537, 589842, 0, 65538, 589843, 0, 65539, 589844, 0, 65537, 589845, 0, 65538, 589846, 0, 65539, 720895, 0, 131073, 655360, 0, 131074, 655361, 0, 131075, 655362, 0, 131073, 655363, 0, 131074, 655364, 0, 131075, 655365, 0, 131073, 655366, 0, 131074, 655367, 0, 131075, 655368, 0, 131073, 655369, 0, 131074, 655370, 0, 131075, 655371, 0, 131073, 655372, 0, 131074, 655373, 0, 131075, 655374, 0, 131073, 655375, 0, 131074, 655376, 0, 131075, 655377, 0, 131073, 655378, 0, 131074, 655379, 0, 131075, 655380, 0, 131073, 655381, 0, 131074, 655382, 0, 131075, 786431, 0, 196609, 720896, 0, 196610, 720897, 0, 196611, 720898, 0, 196609, 720899, 0, 196610, 720900, 0, 196611, 720901, 0, 196609, 720902, 0, 196610, 720903, 0, 196611, 720904, 0, 196609, 720905, 0, 196610, 720906, 0, 196611, 720907, 0, 196609, 720908, 0, 196610, 720909, 0, 196611, 720910, 0, 196609, 720911, 0, 196610, 720912, 0, 196611, 720913, 0, 196609, 720914, 0, 196610, 720915, 0, 196611, 720916, 0, 196609, 720917, 0, 196610, 720918, 0, 196611, 851967, 0, 262145, 786432, 0, 262146, 786433, 0, 262147, 786434, 0, 262145, 786435, 0, 262146, 786436, 0, 262147, 786437, 0, 262145, 786438, 0, 262146, 786439, 0, 262147, 786440, 0, 262145, 786441, 0, 262146, 786442, 0, 262147, 786443, 0, 262145, 786444, 0, 262146, 786445, 0, 262147, 786446, 0, 262145, 786447, 0, 262146, 786448, 0, 262147, 786449, 0, 262145, 786450, 0, 262146, 786451, 0, 262147, 786452, 0, 262145, 786453, 0, 262146, 786454, 0, 262147 )
|
||||||
|
|
||||||
[node name="TileMap Foreground" parent="." index="2"]
|
[node name="TileMap Foreground" parent="." index="2"]
|
||||||
tile_set = ExtResource( 2 )
|
tile_set = ExtResource( 2 )
|
||||||
|
|
@ -26,13 +31,10 @@ tile_data = PoolIntArray( 524288, 0, 2, 524307, 0, 3 )
|
||||||
position = Vector2( 50, 131 )
|
position = Vector2( 50, 131 )
|
||||||
|
|
||||||
[node name="EnterLeft" type="Position2D" parent="." index="4"]
|
[node name="EnterLeft" type="Position2D" parent="." index="4"]
|
||||||
position = Vector2( -14, 44 )
|
position = Vector2( -13, 28 )
|
||||||
|
|
||||||
[node name="EnterRight" type="Position2D" parent="." index="5"]
|
[node name="LevelTransition" parent="." index="5" instance=ExtResource( 4 )]
|
||||||
position = Vector2( 332, 44 )
|
position = Vector2( -12, 31 )
|
||||||
|
|
||||||
[node name="LevelTransition" parent="." index="6" instance=ExtResource( 4 )]
|
|
||||||
position = Vector2( -13, 47 )
|
|
||||||
_transition_type = "door_left"
|
_transition_type = "door_left"
|
||||||
_destination_level = "res://src/levels/TestBox.tscn"
|
_destination_level = "res://src/levels/TestBox.tscn"
|
||||||
_destination_position_name = "EnterRight"
|
_destination_position_name = "EnterRight"
|
||||||
|
|
@ -44,10 +46,10 @@ __meta__ = {
|
||||||
"_edit_lock_": true
|
"_edit_lock_": true
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="LevelTransition2" parent="." index="7" instance=ExtResource( 4 )]
|
[node name="LevelTransition2" parent="." index="6" instance=ExtResource( 4 )]
|
||||||
position = Vector2( 331, 47 )
|
position = Vector2( 332, 31 )
|
||||||
_destination_level = "res://src/levels/TC_01.tscn"
|
_destination_level = "res://src/levels/TestBox.tscn"
|
||||||
_destination_position_name = "EnterLeft"
|
_destination_position_name = "EnterRight"
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="LevelTransition2" index="0"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="LevelTransition2" index="0"]
|
||||||
modulate = Color( 1, 0, 1, 1 )
|
modulate = Color( 1, 0, 1, 1 )
|
||||||
|
|
@ -56,16 +58,23 @@ __meta__ = {
|
||||||
"_edit_lock_": true
|
"_edit_lock_": true
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Camera Bounds" parent="." index="8"]
|
[node name="Camera Bounds" parent="." index="7"]
|
||||||
tile_data = PoolIntArray( -65536, 0, 0, -65521, 0, 0, 65535, 0, 0, 16, 0, 0, 524287, 0, 0, 458768, 0, 0, 589824, 0, 0, 589839, 0, 0 )
|
tile_data = PoolIntArray( -65536, 0, 0, -65521, 0, 0, 65535, 0, 0, 16, 0, 0, 524287, 0, 0, 458768, 0, 0, 589824, 0, 0, 589839, 0, 0 )
|
||||||
|
|
||||||
|
[node name="Modifier_Component" parent="." index="8" instance=ExtResource( 6 )]
|
||||||
|
position = Vector2( 162, 141 )
|
||||||
|
modifier = ExtResource( 5 )
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Modifier_Component" index="0"]
|
||||||
|
shape = SubResource( 3 )
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="." index="9"]
|
[node name="Label" type="Label" parent="." index="9"]
|
||||||
modulate = Color( 0.501961, 0.501961, 0.501961, 1 )
|
|
||||||
margin_left = 78.0
|
margin_left = 78.0
|
||||||
margin_top = 9.0
|
margin_top = 9.0
|
||||||
margin_right = 244.0
|
margin_right = 244.0
|
||||||
margin_bottom = 41.0
|
margin_bottom = 41.0
|
||||||
theme = ExtResource( 7 )
|
theme = ExtResource( 7 )
|
||||||
text = "CB"
|
text = "Test chamber 01:
|
||||||
|
The floor is slippy"
|
||||||
align = 1
|
align = 1
|
||||||
valign = 1
|
valign = 1
|
||||||
|
|
|
||||||
|
|
@ -1,84 +0,0 @@
|
||||||
[gd_scene load_steps=9 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://src/templates/level_templates/LevelTemplate.tscn" type="PackedScene" id=1]
|
|
||||||
[ext_resource path="res://assets/levels/LegacyFantasy-High_Forest/tileset.tres" type="TileSet" id=2]
|
|
||||||
[ext_resource path="res://src/Interactables/LevelTransition.tscn" type="PackedScene" id=4]
|
|
||||||
[ext_resource path="res://src/Interactables/modifiers/icy_surface.tres" type="Resource" id=5]
|
|
||||||
[ext_resource path="res://lib/components/Modifier_Component.tscn" type="PackedScene" id=6]
|
|
||||||
[ext_resource path="res://assets/Fonts/default_font.tres" type="Theme" id=7]
|
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=2]
|
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=3]
|
|
||||||
extents = Vector2( 149, 3 )
|
|
||||||
|
|
||||||
[node name="TC_01" groups=["world"] instance=ExtResource( 1 )]
|
|
||||||
|
|
||||||
[node name="TileMap Background" parent="." index="0"]
|
|
||||||
z_index = -2
|
|
||||||
|
|
||||||
[node name="TileMap Collision" parent="." index="1"]
|
|
||||||
tile_set = ExtResource( 2 )
|
|
||||||
tile_data = PoolIntArray( -262145, 4, 0, -327661, 4, 0, -196609, 4, 0, -262125, 4, 0, -131073, 4, 0, -196589, 4, 0, -65537, 4, 0, -131053, 4, 65536, -1, 4, 0, -65517, 4, 65536, 65535, 4, 0, 19, 4, 65536, 131069, 4, 0, 131070, 4, 0, 131071, 4, 0, 65555, 4, 0, 65556, 4, 65536, 65557, 4, 65536, 65558, 4, 65536, 196605, 4, 0, 131094, 4, 65536, 262141, 4, 0, 196630, 4, 65536, 327677, 4, 0, 262145, 2, 1, 262146, 2, 2, 262161, 2, 0, 262162, 2, 1, 262166, 4, 65536, 393213, 4, 0, 393214, 4, 0, 393215, 4, 0, 327680, 4, 65536, 327681, 2, 65537, 327682, 2, 65538, 327697, 2, 65536, 327698, 2, 65537, 327699, 4, 65536, 327700, 4, 65536, 327701, 4, 65536, 327702, 4, 65536, 393216, 4, 0, 393235, 4, 0, 458752, 4, 65536, 458771, 4, 65536, 589823, 0, 1, 524288, 4, 131072, 524289, 0, 3, 524290, 0, 1, 524291, 0, 2, 524292, 0, 3, 524293, 0, 1, 524294, 0, 2, 524295, 0, 3, 524296, 0, 1, 524297, 0, 2, 524298, 0, 3, 524299, 0, 1, 524300, 0, 2, 524301, 0, 3, 524302, 0, 1, 524303, 0, 2, 524304, 0, 3, 524305, 0, 1, 524306, 0, 2, 524307, 4, 0, 524308, 0, 1, 524309, 0, 2, 524310, 0, 3, 655359, 0, 65537, 589824, 0, 65538, 589825, 0, 65539, 589826, 0, 65537, 589827, 0, 65538, 589828, 0, 65539, 589829, 0, 65537, 589830, 0, 65538, 589831, 0, 65539, 589832, 0, 65537, 589833, 0, 65538, 589834, 0, 65539, 589835, 0, 65537, 589836, 0, 65538, 589837, 0, 65539, 589838, 0, 65537, 589839, 0, 65538, 589840, 0, 65539, 589841, 0, 65537, 589842, 0, 65538, 589843, 0, 65539, 589844, 0, 65537, 589845, 0, 65538, 589846, 0, 65539, 720895, 0, 131073, 655360, 0, 131074, 655361, 0, 131075, 655362, 0, 131073, 655363, 0, 131074, 655364, 0, 131075, 655365, 0, 131073, 655366, 0, 131074, 655367, 0, 131075, 655368, 0, 131073, 655369, 0, 131074, 655370, 0, 131075, 655371, 0, 131073, 655372, 0, 131074, 655373, 0, 131075, 655374, 0, 131073, 655375, 0, 131074, 655376, 0, 131075, 655377, 0, 131073, 655378, 0, 131074, 655379, 0, 131075, 655380, 0, 131073, 655381, 0, 131074, 655382, 0, 131075, 786431, 0, 196609, 720896, 0, 196610, 720897, 0, 196611, 720898, 0, 196609, 720899, 0, 196610, 720900, 0, 196611, 720901, 0, 196609, 720902, 0, 196610, 720903, 0, 196611, 720904, 0, 196609, 720905, 0, 196610, 720906, 0, 196611, 720907, 0, 196609, 720908, 0, 196610, 720909, 0, 196611, 720910, 0, 196609, 720911, 0, 196610, 720912, 0, 196611, 720913, 0, 196609, 720914, 0, 196610, 720915, 0, 196611, 720916, 0, 196609, 720917, 0, 196610, 720918, 0, 196611, 851967, 0, 262145, 786432, 0, 262146, 786433, 0, 262147, 786434, 0, 262145, 786435, 0, 262146, 786436, 0, 262147, 786437, 0, 262145, 786438, 0, 262146, 786439, 0, 262147, 786440, 0, 262145, 786441, 0, 262146, 786442, 0, 262147, 786443, 0, 262145, 786444, 0, 262146, 786445, 0, 262147, 786446, 0, 262145, 786447, 0, 262146, 786448, 0, 262147, 786449, 0, 262145, 786450, 0, 262146, 786451, 0, 262147, 786452, 0, 262145, 786453, 0, 262146, 786454, 0, 262147 )
|
|
||||||
|
|
||||||
[node name="TileMap Foreground" parent="." index="2"]
|
|
||||||
tile_set = ExtResource( 2 )
|
|
||||||
collision_layer = 0
|
|
||||||
collision_mask = 0
|
|
||||||
tile_data = PoolIntArray( 524288, 0, 2, 524307, 0, 3 )
|
|
||||||
|
|
||||||
[node name="PlayerStart" parent="." index="3"]
|
|
||||||
position = Vector2( 50, 131 )
|
|
||||||
|
|
||||||
[node name="EnterLeft" type="Position2D" parent="." index="4"]
|
|
||||||
position = Vector2( -12, 61 )
|
|
||||||
|
|
||||||
[node name="EnterRight" type="Position2D" parent="." index="5"]
|
|
||||||
position = Vector2( 332, 61 )
|
|
||||||
|
|
||||||
[node name="LevelTransition" parent="." index="6" instance=ExtResource( 4 )]
|
|
||||||
position = Vector2( -11, 64 )
|
|
||||||
_transition_type = "door_left"
|
|
||||||
_destination_level = "res://src/levels/CloneBox.tscn"
|
|
||||||
_destination_position_name = "EnterRight"
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="LevelTransition" index="0"]
|
|
||||||
modulate = Color( 1, 0, 1, 1 )
|
|
||||||
shape = SubResource( 2 )
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_lock_": true
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="LevelTransition2" parent="." index="7" instance=ExtResource( 4 )]
|
|
||||||
position = Vector2( 333, 64 )
|
|
||||||
_destination_level = "res://src/levels/TC_02.tscn"
|
|
||||||
_destination_position_name = "EnterLeft"
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="LevelTransition2" index="0"]
|
|
||||||
modulate = Color( 1, 0, 1, 1 )
|
|
||||||
shape = SubResource( 2 )
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_lock_": true
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="Camera Bounds" parent="." index="8"]
|
|
||||||
tile_data = PoolIntArray( -65536, 0, 0, -65521, 0, 0, 65535, 0, 0, 16, 0, 0, 524287, 0, 0, 458768, 0, 0, 589824, 0, 0, 589839, 0, 0 )
|
|
||||||
|
|
||||||
[node name="Modifier_Component" parent="." index="9" instance=ExtResource( 6 )]
|
|
||||||
position = Vector2( 162, 141 )
|
|
||||||
modifier = ExtResource( 5 )
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Modifier_Component" index="0"]
|
|
||||||
modulate = Color( 0, 0, 1, 1 )
|
|
||||||
shape = SubResource( 3 )
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="." index="10"]
|
|
||||||
margin_left = 78.0
|
|
||||||
margin_top = 9.0
|
|
||||||
margin_right = 244.0
|
|
||||||
margin_bottom = 41.0
|
|
||||||
theme = ExtResource( 7 )
|
|
||||||
text = "Test chamber 01:
|
|
||||||
The floor is slippy"
|
|
||||||
align = 1
|
|
||||||
valign = 1
|
|
||||||
|
|
@ -1,84 +0,0 @@
|
||||||
[gd_scene load_steps=9 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://src/templates/level_templates/LevelTemplate.tscn" type="PackedScene" id=1]
|
|
||||||
[ext_resource path="res://assets/levels/LegacyFantasy-High_Forest/tileset.tres" type="TileSet" id=2]
|
|
||||||
[ext_resource path="res://src/Interactables/modifiers/left_conveyor.tres" type="Resource" id=3]
|
|
||||||
[ext_resource path="res://src/Interactables/LevelTransition.tscn" type="PackedScene" id=4]
|
|
||||||
[ext_resource path="res://lib/components/Modifier_Component.tscn" type="PackedScene" id=6]
|
|
||||||
[ext_resource path="res://assets/Fonts/default_font.tres" type="Theme" id=7]
|
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=2]
|
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=3]
|
|
||||||
extents = Vector2( 149, 3 )
|
|
||||||
|
|
||||||
[node name="TC_02" groups=["world"] instance=ExtResource( 1 )]
|
|
||||||
|
|
||||||
[node name="TileMap Background" parent="." index="0"]
|
|
||||||
z_index = -2
|
|
||||||
|
|
||||||
[node name="TileMap Collision" parent="." index="1"]
|
|
||||||
tile_set = ExtResource( 2 )
|
|
||||||
tile_data = PoolIntArray( -262145, 4, 0, -327661, 4, 0, -196609, 4, 0, -262125, 4, 0, -131073, 4, 0, -196589, 4, 0, -65537, 4, 0, -131053, 4, 65536, -1, 4, 0, -65517, 4, 65536, 65535, 4, 0, 19, 4, 65536, 131069, 4, 0, 131070, 4, 0, 131071, 4, 0, 65555, 4, 0, 65556, 4, 65536, 65557, 4, 65536, 65558, 4, 65536, 196605, 4, 0, 131094, 4, 65536, 262141, 4, 0, 196630, 4, 65536, 327677, 4, 0, 262145, 2, 1, 262146, 2, 2, 262161, 2, 0, 262162, 2, 1, 262166, 4, 65536, 393213, 4, 0, 393214, 4, 0, 393215, 4, 0, 327680, 4, 65536, 327681, 2, 65537, 327682, 2, 65538, 327697, 2, 65536, 327698, 2, 65537, 327699, 4, 65536, 327700, 4, 65536, 327701, 4, 65536, 327702, 4, 65536, 393216, 4, 0, 393235, 4, 0, 458752, 4, 65536, 458771, 4, 65536, 589823, 0, 1, 524288, 4, 131072, 524289, 0, 3, 524290, 0, 1, 524291, 0, 2, 524292, 0, 3, 524293, 0, 1, 524294, 0, 2, 524295, 0, 3, 524296, 0, 1, 524297, 0, 2, 524298, 0, 3, 524299, 0, 1, 524300, 0, 2, 524301, 0, 3, 524302, 0, 1, 524303, 0, 2, 524304, 0, 3, 524305, 0, 1, 524306, 0, 2, 524307, 4, 0, 524308, 0, 1, 524309, 0, 2, 524310, 0, 3, 655359, 0, 65537, 589824, 0, 65538, 589825, 0, 65539, 589826, 0, 65537, 589827, 0, 65538, 589828, 0, 65539, 589829, 0, 65537, 589830, 0, 65538, 589831, 0, 65539, 589832, 0, 65537, 589833, 0, 65538, 589834, 0, 65539, 589835, 0, 65537, 589836, 0, 65538, 589837, 0, 65539, 589838, 0, 65537, 589839, 0, 65538, 589840, 0, 65539, 589841, 0, 65537, 589842, 0, 65538, 589843, 0, 65539, 589844, 0, 65537, 589845, 0, 65538, 589846, 0, 65539, 720895, 0, 131073, 655360, 0, 131074, 655361, 0, 131075, 655362, 0, 131073, 655363, 0, 131074, 655364, 0, 131075, 655365, 0, 131073, 655366, 0, 131074, 655367, 0, 131075, 655368, 0, 131073, 655369, 0, 131074, 655370, 0, 131075, 655371, 0, 131073, 655372, 0, 131074, 655373, 0, 131075, 655374, 0, 131073, 655375, 0, 131074, 655376, 0, 131075, 655377, 0, 131073, 655378, 0, 131074, 655379, 0, 131075, 655380, 0, 131073, 655381, 0, 131074, 655382, 0, 131075, 786431, 0, 196609, 720896, 0, 196610, 720897, 0, 196611, 720898, 0, 196609, 720899, 0, 196610, 720900, 0, 196611, 720901, 0, 196609, 720902, 0, 196610, 720903, 0, 196611, 720904, 0, 196609, 720905, 0, 196610, 720906, 0, 196611, 720907, 0, 196609, 720908, 0, 196610, 720909, 0, 196611, 720910, 0, 196609, 720911, 0, 196610, 720912, 0, 196611, 720913, 0, 196609, 720914, 0, 196610, 720915, 0, 196611, 720916, 0, 196609, 720917, 0, 196610, 720918, 0, 196611, 851967, 0, 262145, 786432, 0, 262146, 786433, 0, 262147, 786434, 0, 262145, 786435, 0, 262146, 786436, 0, 262147, 786437, 0, 262145, 786438, 0, 262146, 786439, 0, 262147, 786440, 0, 262145, 786441, 0, 262146, 786442, 0, 262147, 786443, 0, 262145, 786444, 0, 262146, 786445, 0, 262147, 786446, 0, 262145, 786447, 0, 262146, 786448, 0, 262147, 786449, 0, 262145, 786450, 0, 262146, 786451, 0, 262147, 786452, 0, 262145, 786453, 0, 262146, 786454, 0, 262147 )
|
|
||||||
|
|
||||||
[node name="TileMap Foreground" parent="." index="2"]
|
|
||||||
tile_set = ExtResource( 2 )
|
|
||||||
collision_layer = 0
|
|
||||||
collision_mask = 0
|
|
||||||
tile_data = PoolIntArray( 524288, 0, 2, 524307, 0, 3 )
|
|
||||||
|
|
||||||
[node name="PlayerStart" parent="." index="3"]
|
|
||||||
position = Vector2( 50, 131 )
|
|
||||||
|
|
||||||
[node name="EnterLeft" type="Position2D" parent="." index="4"]
|
|
||||||
position = Vector2( -12, 61 )
|
|
||||||
|
|
||||||
[node name="EnterRight" type="Position2D" parent="." index="5"]
|
|
||||||
position = Vector2( 332, 61 )
|
|
||||||
|
|
||||||
[node name="LevelTransition" parent="." index="6" instance=ExtResource( 4 )]
|
|
||||||
position = Vector2( -11, 64 )
|
|
||||||
_transition_type = "door_left"
|
|
||||||
_destination_level = "res://src/levels/TC_01.tscn"
|
|
||||||
_destination_position_name = "EnterRight"
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="LevelTransition" index="0"]
|
|
||||||
modulate = Color( 1, 0, 1, 1 )
|
|
||||||
shape = SubResource( 2 )
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_lock_": true
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="LevelTransition2" parent="." index="7" instance=ExtResource( 4 )]
|
|
||||||
position = Vector2( 333, 64 )
|
|
||||||
_destination_level = "res://src/levels/TC_03.tscn"
|
|
||||||
_destination_position_name = "EnterLeft"
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="LevelTransition2" index="0"]
|
|
||||||
modulate = Color( 1, 0, 1, 1 )
|
|
||||||
shape = SubResource( 2 )
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_lock_": true
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="Camera Bounds" parent="." index="8"]
|
|
||||||
tile_data = PoolIntArray( -65536, 0, 0, -65521, 0, 0, 65535, 0, 0, 16, 0, 0, 524287, 0, 0, 458768, 0, 0, 589824, 0, 0, 589839, 0, 0 )
|
|
||||||
|
|
||||||
[node name="Modifier_Component" parent="." index="9" instance=ExtResource( 6 )]
|
|
||||||
position = Vector2( 162, 141 )
|
|
||||||
modifier = ExtResource( 3 )
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Modifier_Component" index="0"]
|
|
||||||
modulate = Color( 0, 0, 1, 1 )
|
|
||||||
shape = SubResource( 3 )
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="." index="10"]
|
|
||||||
margin_left = 78.0
|
|
||||||
margin_top = 9.0
|
|
||||||
margin_right = 244.0
|
|
||||||
margin_bottom = 41.0
|
|
||||||
theme = ExtResource( 7 )
|
|
||||||
text = "Test chamber 02:
|
|
||||||
The floor moves You"
|
|
||||||
align = 1
|
|
||||||
valign = 1
|
|
||||||
|
|
@ -1,85 +0,0 @@
|
||||||
[gd_scene load_steps=9 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://src/templates/level_templates/LevelTemplate.tscn" type="PackedScene" id=1]
|
|
||||||
[ext_resource path="res://assets/levels/LegacyFantasy-High_Forest/tileset.tres" type="TileSet" id=2]
|
|
||||||
[ext_resource path="res://src/Interactables/modifiers/left_wind.tres" type="Resource" id=3]
|
|
||||||
[ext_resource path="res://src/Interactables/LevelTransition.tscn" type="PackedScene" id=4]
|
|
||||||
[ext_resource path="res://lib/components/Modifier_Component.tscn" type="PackedScene" id=6]
|
|
||||||
[ext_resource path="res://assets/Fonts/default_font.tres" type="Theme" id=7]
|
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=2]
|
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=3]
|
|
||||||
extents = Vector2( 162, 71.5 )
|
|
||||||
|
|
||||||
[node name="TC_03" groups=["world"] instance=ExtResource( 1 )]
|
|
||||||
|
|
||||||
[node name="TileMap Background" parent="." index="0"]
|
|
||||||
z_index = -2
|
|
||||||
|
|
||||||
[node name="TileMap Collision" parent="." index="1"]
|
|
||||||
tile_set = ExtResource( 2 )
|
|
||||||
tile_data = PoolIntArray( -262145, 4, 0, -327661, 4, 0, -196609, 4, 0, -262125, 4, 0, -131073, 4, 0, -196589, 4, 0, -65537, 4, 0, -131053, 4, 65536, -1, 4, 0, -65517, 4, 65536, 65535, 4, 0, 19, 4, 65536, 131069, 4, 0, 131070, 4, 0, 131071, 4, 0, 65555, 4, 0, 65556, 4, 65536, 65557, 4, 65536, 65558, 4, 65536, 196605, 4, 0, 131094, 4, 65536, 262141, 4, 0, 196630, 4, 65536, 327677, 4, 0, 262145, 2, 1, 262146, 2, 2, 262161, 2, 0, 262162, 2, 1, 262166, 4, 65536, 393213, 4, 0, 393214, 4, 0, 393215, 4, 0, 327680, 4, 65536, 327681, 2, 65537, 327682, 2, 65538, 327697, 2, 65536, 327698, 2, 65537, 327699, 4, 65536, 327700, 4, 65536, 327701, 4, 65536, 327702, 4, 65536, 393216, 4, 0, 393235, 4, 0, 458752, 4, 65536, 458771, 4, 65536, 589823, 0, 1, 524288, 4, 131072, 524289, 0, 3, 524290, 0, 1, 524291, 0, 2, 524292, 0, 3, 524293, 0, 1, 524294, 0, 2, 524295, 0, 3, 524296, 0, 1, 524297, 0, 2, 524298, 0, 3, 524299, 0, 1, 524300, 0, 2, 524301, 0, 3, 524302, 0, 1, 524303, 0, 2, 524304, 0, 3, 524305, 0, 1, 524306, 0, 2, 524307, 4, 0, 524308, 0, 1, 524309, 0, 2, 524310, 0, 3, 655359, 0, 65537, 589824, 0, 65538, 589825, 0, 65539, 589826, 0, 65537, 589827, 0, 65538, 589828, 0, 65539, 589829, 0, 65537, 589830, 0, 65538, 589831, 0, 65539, 589832, 0, 65537, 589833, 0, 65538, 589834, 0, 65539, 589835, 0, 65537, 589836, 0, 65538, 589837, 0, 65539, 589838, 0, 65537, 589839, 0, 65538, 589840, 0, 65539, 589841, 0, 65537, 589842, 0, 65538, 589843, 0, 65539, 589844, 0, 65537, 589845, 0, 65538, 589846, 0, 65539, 720895, 0, 131073, 655360, 0, 131074, 655361, 0, 131075, 655362, 0, 131073, 655363, 0, 131074, 655364, 0, 131075, 655365, 0, 131073, 655366, 0, 131074, 655367, 0, 131075, 655368, 0, 131073, 655369, 0, 131074, 655370, 0, 131075, 655371, 0, 131073, 655372, 0, 131074, 655373, 0, 131075, 655374, 0, 131073, 655375, 0, 131074, 655376, 0, 131075, 655377, 0, 131073, 655378, 0, 131074, 655379, 0, 131075, 655380, 0, 131073, 655381, 0, 131074, 655382, 0, 131075, 786431, 0, 196609, 720896, 0, 196610, 720897, 0, 196611, 720898, 0, 196609, 720899, 0, 196610, 720900, 0, 196611, 720901, 0, 196609, 720902, 0, 196610, 720903, 0, 196611, 720904, 0, 196609, 720905, 0, 196610, 720906, 0, 196611, 720907, 0, 196609, 720908, 0, 196610, 720909, 0, 196611, 720910, 0, 196609, 720911, 0, 196610, 720912, 0, 196611, 720913, 0, 196609, 720914, 0, 196610, 720915, 0, 196611, 720916, 0, 196609, 720917, 0, 196610, 720918, 0, 196611, 851967, 0, 262145, 786432, 0, 262146, 786433, 0, 262147, 786434, 0, 262145, 786435, 0, 262146, 786436, 0, 262147, 786437, 0, 262145, 786438, 0, 262146, 786439, 0, 262147, 786440, 0, 262145, 786441, 0, 262146, 786442, 0, 262147, 786443, 0, 262145, 786444, 0, 262146, 786445, 0, 262147, 786446, 0, 262145, 786447, 0, 262146, 786448, 0, 262147, 786449, 0, 262145, 786450, 0, 262146, 786451, 0, 262147, 786452, 0, 262145, 786453, 0, 262146, 786454, 0, 262147 )
|
|
||||||
|
|
||||||
[node name="TileMap Foreground" parent="." index="2"]
|
|
||||||
tile_set = ExtResource( 2 )
|
|
||||||
collision_layer = 0
|
|
||||||
collision_mask = 0
|
|
||||||
tile_data = PoolIntArray( 524288, 0, 2, 524307, 0, 3 )
|
|
||||||
|
|
||||||
[node name="PlayerStart" parent="." index="3"]
|
|
||||||
position = Vector2( 50, 131 )
|
|
||||||
|
|
||||||
[node name="EnterLeft" type="Position2D" parent="." index="4"]
|
|
||||||
position = Vector2( -12, 61 )
|
|
||||||
|
|
||||||
[node name="EnterRight" type="Position2D" parent="." index="5"]
|
|
||||||
position = Vector2( 332, 61 )
|
|
||||||
|
|
||||||
[node name="LevelTransition" parent="." index="6" instance=ExtResource( 4 )]
|
|
||||||
position = Vector2( -11, 64 )
|
|
||||||
_transition_type = "door_left"
|
|
||||||
_destination_level = "res://src/levels/TC_02.tscn"
|
|
||||||
_destination_position_name = "EnterRight"
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="LevelTransition" index="0"]
|
|
||||||
modulate = Color( 1, 0, 1, 1 )
|
|
||||||
shape = SubResource( 2 )
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_lock_": true
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="LevelTransition2" parent="." index="7" instance=ExtResource( 4 )]
|
|
||||||
position = Vector2( 333, 64 )
|
|
||||||
_destination_level = "res://src/levels/CloneBox.tscn"
|
|
||||||
_destination_position_name = "EnterLeft"
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="LevelTransition2" index="0"]
|
|
||||||
modulate = Color( 1, 0, 1, 1 )
|
|
||||||
shape = SubResource( 2 )
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_lock_": true
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="Camera Bounds" parent="." index="8"]
|
|
||||||
tile_data = PoolIntArray( -65536, 0, 0, -65521, 0, 0, 65535, 0, 0, 16, 0, 0, 524287, 0, 0, 458768, 0, 0, 589824, 0, 0, 589839, 0, 0 )
|
|
||||||
|
|
||||||
[node name="Modifier_Component" parent="." index="9" instance=ExtResource( 6 )]
|
|
||||||
position = Vector2( 162, 141 )
|
|
||||||
modifier = ExtResource( 3 )
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Modifier_Component" index="0"]
|
|
||||||
modulate = Color( 0, 0, 1, 1 )
|
|
||||||
position = Vector2( -2, -68.5 )
|
|
||||||
shape = SubResource( 3 )
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="." index="10"]
|
|
||||||
margin_left = 78.0
|
|
||||||
margin_top = 9.0
|
|
||||||
margin_right = 244.0
|
|
||||||
margin_bottom = 41.0
|
|
||||||
theme = ExtResource( 7 )
|
|
||||||
text = "Test chamber 03:
|
|
||||||
It's Windy"
|
|
||||||
align = 1
|
|
||||||
valign = 1
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
[gd_scene load_steps=5 format=2]
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/parent_scenes/projectile.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://src/parent_scenes/projectile.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://assets/items/mushroom_icon.png" type="Texture" id=2]
|
[ext_resource path="res://assets/items/mushroom_icon.png" type="Texture" id=2]
|
||||||
[ext_resource path="res://assets_tmp/SE/pop.wav" type="AudioStream" id=3]
|
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape2D" id=1]
|
[sub_resource type="CapsuleShape2D" id=1]
|
||||||
radius = 6.0
|
radius = 6.0
|
||||||
|
|
@ -11,7 +10,6 @@ height = 2.0
|
||||||
[node name="MushroomPew" groups=["world"] instance=ExtResource( 1 )]
|
[node name="MushroomPew" groups=["world"] instance=ExtResource( 1 )]
|
||||||
velocity_pps = 300.0
|
velocity_pps = 300.0
|
||||||
lifespan = 0.5
|
lifespan = 0.5
|
||||||
sound_effect = ExtResource( 3 )
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="0"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="0"]
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user