Compare commits

..

28 Commits

Author SHA1 Message Date
e2c77b05e3 SE manager working. Mushroom pew now pows. 2025-06-01 17:10:04 -07:00
9cf13cc5b8 Jump adjustments for crap jumps. 2025-06-01 11:08:34 -07:00
a195e7be2d Snapping to ledge a little better on grab, jump height test in first clonebox 2025-06-01 10:34:27 -07:00
d934c815e0 Ledge grab tweaks 2025-05-31 22:07:56 -07:00
f833f1cec7 Tweaks to movement states and modifiers for more realistic values 2025-05-31 21:36:40 -07:00
b7002f03ad Some odd dash behavior on slip surfaces but otherwise, add return after state change to fix long standing weirdness of processing the wrong movement parameters right before state change. 2025-05-31 21:27:30 -07:00
5197b3a608 It actually kinda works! 2025-05-31 08:41:17 -07:00
327e02d00b More modifier rooms 2025-05-30 21:56:45 -07:00
2ef9a36851 Remove unused code in movement parameters 2025-05-30 20:40:14 -07:00
59f2823b21 Good progress but crouch move is a little off for some reason 2025-05-29 22:30:21 -07:00
4c7f5f1f4d Better impulse model. 2025-05-29 21:55:45 -07:00
27590aba90 Still impulse issues, testing a new icy surface box. 2025-05-28 22:01:49 -07:00
d1d7e24936 Movement based only on input for static movement. No acceleration then only input. 2025-05-27 21:52:42 -07:00
a0aae4fbcb Moving static speed to outside of inertia resolve function. 2025-05-27 20:24:58 -07:00
3b37b568c5 Bug fix and linking to another level 2025-05-26 20:49:33 -07:00
4a95ec08f4 Impulse maybe working 2025-05-26 12:05:41 -07:00
e7f08fd351 Busted impulse. 2025-05-25 19:17:14 -07:00
8960fddef2 Some cleanup of unused code after all that mess. 2025-05-25 18:57:51 -07:00
bb3f6f5501 Now using unified inertia calculation function for both horizontal and vertical movement! Getting closer, finally. 2025-05-25 18:48:04 -07:00
675a0181f0 Generalized resolve_inertia function. Have a bug on dash after land. 2025-05-25 18:40:21 -07:00
25046c852f Jump bug fixed. 2025-05-25 13:41:14 -07:00
76ec165863 Jump looking better. Seems we made gravity optional by relative movement in y axis and desired movement never being set to down. 2025-05-25 10:23:14 -07:00
230c91079f Clonebox now does nothing. 2025-05-25 10:10:56 -07:00
d7d612db72 Acceleration now directionless. It doesn't work yet but at least it doesn't crash. 2025-05-25 10:03:26 -07:00
b49b1d67d2 I took a break. What was I doing. 2025-05-24 08:14:33 -07:00
a02eb6830a New model, new problems. 2025-05-15 00:02:17 -07:00
a3c3d2db9f Total switch of export params for movement params and modifiers, state is next. 2025-05-14 23:49:33 -07:00
6626e03fb1 Yet another movement model 2025-05-14 23:13:13 -07:00
36 changed files with 1001 additions and 365 deletions

View File

@ -1,11 +1,18 @@
class_name MovementParameters
extends Reference
## Vector based ones for x and y
export var base_move_speed :Vector2
export var base_move_acceleration :Vector2
export var move_speed_modifier :Vector2
export var move_speed_modifier_acceleration :Vector2
# Allow floats from -10 to 20 and snap the value to multiples of 0.2.
export(PoolVector2Array) var _speed_start = PoolVector2Array([Vector2(0,0),Vector2(0,0),Vector2(0,0)])
export(PoolVector2Array) var _speed_end = PoolVector2Array([Vector2(0,0),Vector2(0,0),Vector2(0,0)])
## 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
var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity")
@ -14,15 +21,38 @@ var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity")
## Can be set to help with debugging the velocity controller
export var debug_name :String
# export var base_h_move_speed :float
# export var base_h_move_acceleration :float
# export var h_move_speed_modifier :float
# export var h_move_modifier_move_acceleration :float
func get_speed_start(direction :int) -> Vector2:
return _speed_start[direction]
func set_speed_start(direction :int, value :Vector2) -> void:
_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):
pass
@ -30,61 +60,68 @@ func modify(_movement_parameters :MovementParameters):
func apply_multiple_modifiers( _modifiers: Array, _movement_direction :Vector2):
for m in _modifiers:
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)
func apply_state_modifier(_modifier :StateModifierMovement, _movement_direction :Vector2):
#_modifier.direction == _modifier.APPLIED_DIRECTIONS.LEFT_OR_UP
match _modifier.modifier_type:
##TODO: probably math the min and max as well somehow
## Accel processing is the same regardless of direction now
set_acceleration( ( _acceleration + _modifier.acceleration),
_modifier.min_acceleration,
_modifier.max_acceleration )
match _modifier.processing_mode:
StateModifierMovement.SUB_TYPE.NEGATIVE_CONSTRAINT:
var adjusted_move_speed = base_move_speed.x + _modifier.horizontal_speed
## We crossed the zero from the base
if sign(adjusted_move_speed) != sign(base_move_speed.x):
base_move_speed.x = 0.0
else:
base_move_speed.x = adjusted_move_speed
var adjusted_accel = base_move_acceleration.x + _modifier.horizontal_acceleration
if sign(adjusted_accel) != sign(base_move_acceleration.x):
base_move_acceleration.x = 0.0
else:
base_move_acceleration.x = adjusted_accel
##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
var speed :Vector2 = get_speed_start(_modifier.direction)
var adjusted_move_speed = get_speed_start(_modifier.direction) + _modifier.speed_start
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_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
_:
base_move_speed.x += _modifier.horizontal_speed
base_move_acceleration.x += _modifier.horizontal_acceleration
move_speed_modifier.x += _modifier.horizontal_speed_offset
move_speed_modifier_acceleration.x += _modifier.horizontal_speed_offset_acceleration
base_move_speed.y += _modifier.vertical_speed
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') +
"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}) +
"\nMoveAccel: {0}, {1}".format({"0":"%4.1f" % base_move_acceleration.x, "1":"%4.1f" % base_move_acceleration.y}) +
"\nType: " + str(_modifier.modifier_type)
)
set_speed_start(
_modifier.direction,
(get_speed_start(_modifier.direction) + _modifier.speed_start)
)
set_speed_end(
_modifier.direction,
(get_speed_end(_modifier.direction) + _modifier.speed_end)
)
if (true): #DEGUG
var foo = 2+2
# 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}) +
# "\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}) +
# "\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
# }

View File

@ -69,6 +69,7 @@ func process_physics(delta):
# more likely needed for Players
func process_physics_input(delta):
physics_delta = delta
desired_movement_vector = Vector2(0,0)
if has_method('_state_process_physics_input_' + current_state.name):
call('_state_process_physics_input_' + current_state.name)
@ -155,7 +156,8 @@ func apply_state_modifier(movement_parameters :MovementParameters) -> MovementPa
var active_mods :bool= true
var mods :Array = get_state_machine_modifiers.call_func('StateModifierMovement', active_mods, current_state.is_grounded)
if (mods.size() > 0):
movement_parameters.apply_multiple_modifiers(mods, Vector2(0,0))
## Process mods and supply current velocity for single directions
movement_parameters.apply_multiple_modifiers(mods, velocity_controller.velocity)
return movement_parameters

View File

@ -7,7 +7,22 @@ extends State
##
## @WIP
const RELATIVE_DIRECTION = 0
# 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
export var horizontal_speed: float = 60
export var horizontal_acceleration: float = 0
@ -15,7 +30,7 @@ export var horizontal_acceleration: float = 0
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 = 1.0
#export var jerk_factor: float = 1.0
export var vertical_speed: float = 0
export var vertical_acceleration: float = 0
@ -25,7 +40,7 @@ export var vertical_speed_offset: float = 0
export var vertical_speed_offset_acceleration: float = 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
export var preserve_inertia :bool = true
@ -57,15 +72,25 @@ func enter() -> void:
func get_movement_parameters() -> MovementParameters:
var movement_parameters = MovementParameters.new()
movement_parameters.debug_name = name
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
movement_parameters.set_speed_start(RELATIVE_DIRECTION, speed_start)
#movement_parameters.speed_start = speed_start
movement_parameters.set_speed_end(RELATIVE_DIRECTION, speed_end)
#movement_parameters.speed_end = speed_end
movement_parameters.set_acceleration(acceleration, min_acceleration, max_acceleration)
#movement_parameters.acceleration = acceleration
movement_parameters.jerk_factor = jerk_factor
## 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

View File

@ -1,24 +1,10 @@
class_name StateModifierMovement
extends StateModifier
## 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(float, -1.0, 1, 1.0) var applied_direction = 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)
enum APPLIED_DIRECTIONS {
LEFT_OR_UP = -1,
@ -26,7 +12,36 @@ enum APPLIED_DIRECTIONS {
RIGHT_OR_DOWN = 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
## 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
enum SUB_TYPE {
@ -43,21 +58,24 @@ func _to_string():
func reset():
.reset()
modifier_type = SUB_TYPE.NONE
direction = 0.0
horizontal_speed = 0
horizontal_acceleration = 0
## Movement Speed Offsets (Positive or Negative)
horizontal_speed_offset = 0
## Applies only if offset applies
horizontal_speed_offset_acceleration = 0
# direction = 0.0
# horizontal_speed = 0
# horizontal_acceleration = 0
# ## Movement Speed Offsets (Positive or Negative)
# horizontal_speed_offset = 0
# ## Applies only if offset applies
# horizontal_speed_offset_acceleration = 0
#jerk_factor = 0
func copy(_copy_state: StateModifier):
.copy(_copy_state)
modifier_type = _copy_state.modifier_type
if _copy_state.to_string() == "StateModifierMovement":
_copy_state.horizontal_speed = horizontal_speed
_copy_state.horizontal_acceleration = horizontal_acceleration
#_copy_state.horizontal_speed = horizontal_speed
_copy_state.speed.start = speed_start
_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
## should only apply while in the air.
@ -81,13 +99,25 @@ func merge(_merge_from_modifier: StateModifier):
##TODO: I don't really need merge functions here?
match _merge_from_modifier.modifier_type:
_:
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
speed_end += _merge_from_modifier.speed_end
speed_start += _merge_from_modifier.speed_start
acceleration += _merge_from_modifier.acceleration
if (_merge_from_modifier.min_acceleration.x < min_acceleration.x):
min_acceleration.x = _merge_from_modifier.min_acceleration.x
if (_merge_from_modifier.min_acceleration.y < min_acceleration.y):
min_acceleration.y = _merge_from_modifier.min_acceleration.y
if (_merge_from_modifier.max_acceleration.x > max_acceleration.x):
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
only_grounded = _merge_from_modifier.only_grounded

View File

@ -0,0 +1,53 @@
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

View File

@ -224,6 +224,7 @@ PlayerInfo="*res://lib/singleton_autoloads/PlayerInfo.gd"
UiManager="*res://lib/singleton_autoloads/UIManager.gd"
LevelInfo="*res://lib/singleton_autoloads/LevelInfo.gd"
NetworkManager="*res://lib/singleton_autoloads/NetworkManager.gd"
SoundEffectManager="*res://lib/singleton_autoloads/SoundEffectManager.gd"
[debug]

View File

@ -9,15 +9,12 @@ script = ExtResource( 1 )
modifier_type = 0
name = "ice_or_something"
timeout_seconds = 0.0
horizontal_speed = 0.0
horizontal_acceleration = -250.0
horizontal_speed_offset = 0.0
horizontal_speed_offset_acceleration = 0.0
vertical_speed = 0.0
vertical_acceleration = 0.0
vertical_speed_offset = 0.0
vertical_speed_offset_acceleration = 0.0
gravity = 0
direction = 0
speed_start = Vector2( -20, 1.36422e-12 )
speed_end = Vector2( 0, 0 )
min_acceleration = Vector2( 30, 1.36422e-12 )
acceleration = Vector2( -250, 1.36422e-12 )
max_acceleration = Vector2( 0, 0 )
gravity = 0
only_grounded = true
processing_mode = 0
processing_mode = 1

View File

@ -9,15 +9,12 @@ script = ExtResource( 1 )
modifier_type = 0
name = "conveyor_left"
timeout_seconds = 0.0
horizontal_speed = -30.0
horizontal_acceleration = 0.0
horizontal_speed_offset = 0.0
horizontal_speed_offset_acceleration = 0.0
vertical_speed = 0.0
vertical_acceleration = 0.0
vertical_speed_offset = 0.0
vertical_speed_offset_acceleration = 0.0
gravity = 0
direction = -1
speed_start = Vector2( 30, 1.36422e-12 )
speed_end = Vector2( 30, 1.36422e-12 )
min_acceleration = Vector2( 0, 0 )
acceleration = Vector2( 0, 0 )
max_acceleration = Vector2( 0, 0 )
gravity = 0
only_grounded = true
processing_mode = 0

View File

@ -9,15 +9,12 @@ script = ExtResource( 1 )
modifier_type = 0
name = "wind_left"
timeout_seconds = 0.0
horizontal_speed = -30.0
horizontal_acceleration = 0.0
horizontal_speed_offset = 0.0
horizontal_speed_offset_acceleration = 0.0
vertical_speed = 0.0
vertical_acceleration = 0.0
vertical_speed_offset = 0.0
vertical_speed_offset_acceleration = 0.0
direction = 1
speed_start = Vector2( 30, 1.36422e-12 )
speed_end = Vector2( 30, 1.36422e-12 )
min_acceleration = Vector2( 0, 0 )
acceleration = Vector2( 0, 0 )
max_acceleration = Vector2( 0, 0 )
gravity = 0
direction = -1
only_grounded = false
processing_mode = 0

View File

@ -1,5 +1,7 @@
extends Movement_StateReceiver
export var debug_velocity_controller :bool = false
var parent_request_state_change :FuncRef
var parent_use_primary_item :FuncRef
@ -11,6 +13,9 @@ onready var stamina_component = $"%Stamina_Component"
var state_stamina_cost :Dictionary
func _ready():
if debug_velocity_controller:
velocity_controller.debug = true
#var state_ref :State
#var state_name :String
#state_name = 'jump'
@ -46,6 +51,7 @@ func wants_jump() -> bool:
return true
else:
_wants_jump = false
desired_movement_vector.y = DOWN
return false
var _wants_crouch :bool
@ -117,7 +123,6 @@ func process_physics_input(delta):
# call the parent, Which would call the individuals
.process_physics_input(delta)
# then process movement controls
physics_delta = delta
get_movement_direction()
wants_jump()
wants_crouch()
@ -135,30 +140,38 @@ func _state_process_physics_idle():
##Bugfix
if _wants_jump:
request_state_change.call_func('jump')
return
if _wants_crouch == true:
request_state_change.call_func('crouch')
return
##TODO: May need that 'bump' logic to make velocity work.
if desired_movement_vector.x != 0: # and velocity.x != 0:
request_state_change.call_func('move')
return
if !parent.is_on_floor():
#return fall_state
request_state_change.call_func('fall')
return
if _wants_roll == true:
request_state_change.call_func('roll')
return
if _wants_attack_primary == true:
#request_state_change.call_func('attack_shoot')
attack_primary()
return
if _wants_attack_secondary == true:
#parent_request_state_change.call_func('attack_sword')
attack_secondary()
return
if $"%LadderDetector".is_colliding() and _wants_climb == true:
request_state_change.call_func('climb')
return
# var _v :Vector2 = new_move_actor_as_desired( physics_delta , current_state )
# apply_movement_to_parent(_v)
@ -179,6 +192,7 @@ func attack_primary():
var _item_state_name :String = parent_use_primary_item.call_func()
if _item_state_name != '':
request_state_change.call_func(_item_state_name)
return
@ -187,6 +201,7 @@ func attack_secondary():
var _item_state_name :String = get_parent().use_secondary_item()
if _item_state_name != '':
request_state_change.call_func(_item_state_name)
return
func _state_process_physics_attack_shoot():
@ -198,30 +213,37 @@ func _state_process_physics_attack_shoot():
if current_state.animation_finished == true:
request_state_change.call_func('idle')
return
if !parent.is_on_floor():
#return fall_state
request_state_change.call_func('fall')
return
func _state_process_physics_attack_punch():
if current_state.animation_finished == true:
request_state_change.call_func('idle')
return
if !parent.is_on_floor():
#return fall_state
request_state_change.call_func('fall')
return
func _state_process_physics_attack_sword():
if current_state.animation_finished == true:
request_state_change.call_func('idle')
return
if !parent.is_on_floor():
#return fall_state
request_state_change.call_func('fall')
return
func _state_process_physics_roll():
if current_state.animation_finished == true:
request_state_change.call_func('idle')
return
# Force role in facing direction
# instead of movement direction
@ -231,11 +253,11 @@ func _state_process_physics_roll():
velocity_controller.calculate_velocity(
physics_delta ,
apply_state_modifier(current_state.get_movement_parameters()),
parent.transform.x )
Vector2(parent.transform.x.x, desired_movement_vector.y) )
)
if !parent.is_on_floor():
#return fall_state
request_state_change.call_func('fall')
# if !parent.is_on_floor():
# #return fall_state
# request_state_change.call_func('fall')
var level_transition_latch: bool
var level_enter_dir: float
@ -258,6 +280,7 @@ func _state_process_physics_enter_right():
level_transition_latch = true
elif current_state.state_timeout.time_left == 0 and level_transition_latch == true:
request_state_change.call_func('idle')
return
# Force role in facing direction
# instead of movement direction
@ -266,17 +289,19 @@ func _state_process_physics_enter_right():
velocity_controller.calculate_velocity(
physics_delta ,
apply_state_modifier(current_state.get_movement_parameters()),
parent.transform.x )
Vector2(parent.transform.x.x, desired_movement_vector.y) )
)
func _state_process_physics_land():
$"%LedgeDetector".set_enabled(true)
if current_state.animation_finished == true:
request_state_change.call_func('idle')
return
if !parent.is_on_floor():
#return fall_state
request_state_change.call_func('fall')
return
#move_actor_as_desired()
apply_movement_to_parent(
velocity_controller.calculate_velocity(
@ -288,6 +313,7 @@ func _state_process_physics_land():
func _state_process_physics_hurt():
if current_state.state_timeout.time_left == 0:
request_state_change.call_func('idle')
return
# if !parent.is_on_floor():
# #return fall_state
@ -304,17 +330,20 @@ func _state_process_physics_hurt():
func _state_process_physics_fall():
flip_sprite_to_movement_direction()
var foo = $"%LedgeDetector".is_colliding()
var bar = $"%WallDetector".is_colliding()
if $"%LedgeDetector".is_colliding() and !$"%WallDetector".is_colliding():
#print("it touched me!")
if debug_component:
UiManager.debug_text = (str($"%LedgeDetector".get_collision_point()))
request_state_change.call_func('ledge_grab')
return
if parent.is_on_floor():
#modifier.reference()
#idle_state.modifier = landing_modifier
request_state_change.call_func('land')
return
#move_actor_as_desired()
apply_movement_to_parent(
@ -327,7 +356,7 @@ func _state_process_physics_fall():
func _state_process_physics_jump():
flip_sprite_to_movement_direction()
#Apparently we're instantly landing
# if parent.is_on_floor():
# #modifier.reference()
@ -335,6 +364,7 @@ func _state_process_physics_jump():
# request_state_change.call_func('idle')
if velocity_controller.velocity.y > 0:
request_state_change.call_func('fall')
return
desired_movement_vector.y = UP
#move_actor_as_desired()
apply_movement_to_parent(
@ -343,6 +373,15 @@ func _state_process_physics_jump():
apply_state_modifier(current_state.get_movement_parameters()),
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():
# flip sprite in direction
@ -350,12 +389,15 @@ func _state_process_physics_move():
if _wants_jump:
request_state_change.call_func('jump')
return
if desired_movement_vector.x == 0:
request_state_change.call_func('idle')
return
if !parent.is_on_floor():
request_state_change.call_func('fall')
return
## First version
#move_actor_as_desired()
@ -409,20 +451,35 @@ func _state_process_physics_climb():
# animations.stop()
else:
return request_state_change.call_func('idle')
if _wants_crouch:
request_state_change.call_func('fall')
return
func _state_process_physics_ledge_grab():
if debug_component:
UiManager.debug_text = (str(velocity_controller.velocity))
$"%LedgeDetector".set_enabled(false)
var foo = $"%LedgeDetector".is_colliding()
var bar = $"%WallDetector".is_colliding()
if _wants_jump:
request_state_change.call_func('ledge_climb')
return
if _wants_crouch:
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():
# $"../LedgeDetector".set_enabled(false)
@ -456,14 +513,25 @@ func _state_process_physics_crouch():
if _wants_crouch != true:
request_state_change.call_func('idle')
return
if !parent.is_on_floor():
request_state_change.call_func('fall')
return
if _wants_crouch == true and desired_movement_vector.x != 0:
request_state_change.call_func('crouch_move')
return
elif desired_movement_vector.x != 0: # and velocity.x != 0:
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():
# flip sprite in direction
@ -471,14 +539,18 @@ func _state_process_physics_crouch_move():
if _wants_crouch != true:
request_state_change.call_func('idle')
return
if !parent.is_on_floor():
request_state_change.call_func('fall')
return
if _wants_crouch == true and desired_movement_vector.x == 0:
request_state_change.call_func('crouch')
return
elif _wants_crouch != true and desired_movement_vector.x != 0:
request_state_change.call_func('move')
return
#move_actor_as_desired()
apply_movement_to_parent(

View File

@ -71,7 +71,9 @@ func _ready():
movement_component.state_stamina_cost = state_stamina_cost
tired_debuff_modifier.setup('so_tired', StateModifierMovement.SUB_TYPE.NEGATIVE_CONSTRAINT)
tired_debuff_modifier.horizontal_speed = -40
tired_debuff_modifier.speed_start = Vector2(-40,0)
tired_debuff_modifier.processing_mode = StateModifierMovement.SUB_TYPE.NEGATIVE_CONSTRAINT
#tired_debuff_modifier.horizontal_speed = -40
tired_debuff_modifier.only_grounded = true
movement_state_machine.push_state_modifier(tired_debuff_modifier)

View File

@ -38,15 +38,21 @@
[sub_resource type="Resource" id=3]
resource_local_to_scene = true
resource_name = "hurt"
script = ExtResource( 18 )
debug_state = false
timeout_seconds = 2.0
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_acceleration = 0.0
horizontal_speed_offset = 0.0
horizontal_speed_offset_acceleration = 0.0
jerk_factor = 0.0
vertical_speed = 0.0
vertical_acceleration = 0.0
vertical_speed_offset = 0.0
@ -99,8 +105,7 @@ states = [ ExtResource( 4 ), ExtResource( 9 ), ExtResource( 7 ), ExtResource( 8
[node name="AnimatedSprite_StateReceiver" parent="." index="1"]
frames = ExtResource( 2 )
animation = "attack-punch"
frame = 7
animation = "jump"
script = ExtResource( 5 )
__meta__ = {
"_aseprite_wizard_config_": {
@ -118,6 +123,7 @@ __meta__ = {
[node name="Movement_StateReceiver" parent="." index="2"]
script = ExtResource( 6 )
debug_velocity_controller = false
[node name="Modifier_Receiver" parent="." index="3" instance=ExtResource( 35 )]
callable_state_machine = NodePath("../Movement_StateMachine")
@ -126,9 +132,9 @@ debug_receiver = true
[node name="LedgeDetector" type="RayCast2D" parent="." index="4"]
unique_name_in_owner = true
modulate = Color( 0, 1, 0, 1 )
position = Vector2( 8, -10 )
position = Vector2( 6, -10 )
enabled = true
cast_to = Vector2( 1.36422e-12, -1 )
cast_to = Vector2( 4, -1 )
[node name="WallDetector" type="RayCast2D" parent="." index="5"]
unique_name_in_owner = true
@ -137,7 +143,21 @@ position = Vector2( 6, -16 )
enabled = true
cast_to = Vector2( 4, 4 )
[node name="LadderDetector" type="RayCast2D" parent="." index="6"]
[node name="JumpAdjustorBack" 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
modulate = Color( 0, 1, 0, 1 )
enabled = true
@ -146,25 +166,25 @@ collision_mask = 1024
collide_with_areas = true
collide_with_bodies = false
[node name="AudioStreamPlayer_StateReceiver" parent="." index="7"]
[node name="AudioStreamPlayer_StateReceiver" parent="." index="9"]
sound_effects = [ SubResource( 4 ), SubResource( 5 ), SubResource( 6 ) ]
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="8"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="10"]
position = Vector2( 0, 2 )
shape = SubResource( 1 )
script = ExtResource( 31 )
callable_state_machine = NodePath("../Movement_StateMachine")
[node name="Health_Component" parent="." index="9" instance=ExtResource( 17 )]
[node name="Health_Component" parent="." index="11" instance=ExtResource( 17 )]
unique_name_in_owner = true
max_health = 100
[node name="Stamina_Component" parent="." index="10" instance=ExtResource( 29 )]
[node name="Stamina_Component" parent="." index="12" instance=ExtResource( 29 )]
unique_name_in_owner = true
max_stamina = 50
recovery_rate = 2
[node name="Hurtbox_Component" parent="." index="11" instance=ExtResource( 16 )]
[node name="Hurtbox_Component" parent="." index="13" instance=ExtResource( 16 )]
collision_layer = 16
collision_mask = 128
hurtbox_entered_function = "hit_Receiver"
@ -176,13 +196,13 @@ shape = SubResource( 2 )
script = ExtResource( 34 )
callable_state_machine = NodePath("../../Movement_StateMachine")
[node name="Interactable_Receiver" type="Node" parent="." index="12"]
[node name="Interactable_Receiver" type="Node" parent="." index="14"]
script = ExtResource( 21 )
interactable_parent_callback = "touch_the_thing"
[node name="PewMachine" parent="." index="13" instance=ExtResource( 28 )]
[node name="PewMachine" parent="." index="15" instance=ExtResource( 28 )]
[node name="Hitbox_Component" parent="." index="14" instance=ExtResource( 33 )]
[node name="Hitbox_Component" parent="." index="16" instance=ExtResource( 33 )]
collision_layer = 192
damage_amount = 10

View File

@ -9,11 +9,16 @@ script = ExtResource( 1 )
debug_state = false
timeout_seconds = 0.0
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_acceleration = 0.0
horizontal_speed_offset = 0.0
horizontal_speed_offset_acceleration = 0.0
jerk_factor = 0.0
vertical_speed = 0.0
vertical_acceleration = 0.0
vertical_speed_offset = 0.0

View File

@ -9,11 +9,16 @@ script = ExtResource( 1 )
debug_state = false
timeout_seconds = 0.0
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_acceleration = 0.0
horizontal_speed_offset = 0.0
horizontal_speed_offset_acceleration = 0.0
jerk_factor = 0.0
vertical_speed = 0.0
vertical_acceleration = 0.0
vertical_speed_offset = 0.0

View File

@ -9,11 +9,16 @@ script = ExtResource( 1 )
debug_state = false
timeout_seconds = 0.0
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_acceleration = 0.0
horizontal_speed_offset = 0.0
horizontal_speed_offset_acceleration = 0.0
jerk_factor = 0.0
vertical_speed = 0.0
vertical_acceleration = 0.0
vertical_speed_offset = 0.0

View File

@ -8,11 +8,16 @@ script = ExtResource( 1 )
debug_state = false
timeout_seconds = 0.0
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_acceleration = 0.0
horizontal_speed_offset = 0.0
horizontal_speed_offset_acceleration = 0.0
jerk_factor = 0.0
vertical_speed = 0.0
vertical_acceleration = 0.0
vertical_speed_offset = 0.0

View File

@ -9,11 +9,16 @@ script = ExtResource( 1 )
debug_state = false
timeout_seconds = 0.0
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_acceleration = 0.0
horizontal_speed_offset = 0.0
horizontal_speed_offset_acceleration = 0.0
jerk_factor = 0.0
vertical_speed = 0.0
vertical_acceleration = 0.0
vertical_speed_offset = 0.0

View File

@ -9,11 +9,16 @@ script = ExtResource( 1 )
debug_state = false
timeout_seconds = 0.0
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_acceleration = 0.0
horizontal_speed_offset = 0.0
horizontal_speed_offset_acceleration = 0.0
jerk_factor = 0.0
vertical_speed = 0.0
vertical_acceleration = 0.0
vertical_speed_offset = 0.0

View File

@ -9,17 +9,22 @@ script = ExtResource( 1 )
debug_state = false
timeout_seconds = 0.0
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_acceleration = 0.0
horizontal_speed_offset = 0.0
horizontal_speed_offset_acceleration = 0.0
jerk_factor = 0.0
vertical_speed = 0.0
vertical_acceleration = 0.0
vertical_speed_offset = 0.0
vertical_speed_offset_acceleration = 0.0
horizontal_jerk_factor = 1.0
vertical_jerk_factor = 1.0
preserve_inertia = true
preserve_inertia = false
is_grounded = true
animation_sequence = [ "death" ]

View File

@ -8,17 +8,22 @@ script = ExtResource( 1 )
debug_state = false
timeout_seconds = 1.0
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_acceleration = 0.0
horizontal_speed_offset = 0.0
horizontal_speed_offset_acceleration = 0.0
jerk_factor = 0.0
vertical_speed = 0.0
vertical_acceleration = 0.0
vertical_speed_offset = 0.0
vertical_speed_offset_acceleration = 0.0
horizontal_jerk_factor = 1.0
vertical_jerk_factor = 1.0
preserve_inertia = true
preserve_inertia = false
is_grounded = true
animation_sequence = [ "walk" ]

View File

@ -9,11 +9,16 @@ script = ExtResource( 1 )
debug_state = false
timeout_seconds = 0.0
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_acceleration = 0.0
horizontal_speed_offset = 0.0
horizontal_speed_offset_acceleration = 0.0
jerk_factor = 1.0
vertical_speed = 0.0
vertical_acceleration = 0.0
vertical_speed_offset = 0.0

View File

@ -9,11 +9,16 @@ script = ExtResource( 1 )
debug_state = false
timeout_seconds = 0.0
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_acceleration = 300.0
horizontal_speed_offset = 0.0
horizontal_speed_offset_acceleration = 0.0
jerk_factor = 1.0
vertical_speed = 0.0
vertical_acceleration = 0.0
vertical_speed_offset = 0.0

View File

@ -9,11 +9,16 @@ script = ExtResource( 1 )
debug_state = false
timeout_seconds = 0.0
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_acceleration = 0.0
horizontal_speed_offset = 0.0
horizontal_speed_offset_acceleration = 0.0
jerk_factor = 1.0
vertical_speed = 200.0
vertical_acceleration = 0.0
vertical_speed_offset = -208.0

View File

@ -9,11 +9,16 @@ script = ExtResource( 1 )
debug_state = false
timeout_seconds = 0.0
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_acceleration = 0.0
horizontal_speed_offset = 0.0
horizontal_speed_offset_acceleration = 0.0
jerk_factor = 0.0
vertical_speed = 0.0
vertical_acceleration = 0.0
vertical_speed_offset = 0.0

View File

@ -9,17 +9,22 @@ script = ExtResource( 1 )
debug_state = false
timeout_seconds = 0.0
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_acceleration = 0.0
horizontal_speed_offset = 0.0
horizontal_speed_offset_acceleration = 0.0
jerk_factor = 0.0
vertical_speed = 0.0
vertical_acceleration = 0.0
vertical_speed_offset = 0.0
vertical_speed_offset_acceleration = 0.0
horizontal_jerk_factor = 1.0
vertical_jerk_factor = 1.0
preserve_inertia = true
preserve_inertia = false
is_grounded = true
animation_sequence = [ "ledge-climb" ]

View File

@ -9,17 +9,22 @@ script = ExtResource( 1 )
debug_state = false
timeout_seconds = 0.0
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_acceleration = 0.0
horizontal_speed_offset = 0.0
horizontal_speed_offset_acceleration = 0.0
jerk_factor = 0.0
vertical_speed = 0.0
vertical_acceleration = 0.0
vertical_speed_offset = 0.0
vertical_speed_offset_acceleration = 0.0
horizontal_jerk_factor = 1.0
vertical_jerk_factor = 1.0
preserve_inertia = true
preserve_inertia = false
is_grounded = true
animation_sequence = [ "ledge-grab" ]

View File

@ -9,11 +9,16 @@ script = ExtResource( 1 )
debug_state = false
timeout_seconds = 0.0
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_acceleration = 70.0
horizontal_speed_offset = 80.0
horizontal_speed_offset_acceleration = 0.0
jerk_factor = 0.0
vertical_speed = 0.0
vertical_acceleration = 0.0
vertical_speed_offset = 0.0

View File

@ -9,11 +9,16 @@ script = ExtResource( 1 )
debug_state = false
timeout_seconds = 0.0
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_acceleration = 1.36422e-12
horizontal_speed_offset = -140.0
horizontal_speed_offset_acceleration = -300.0
jerk_factor = 1.0
vertical_speed = 0.0
vertical_acceleration = 0.0
vertical_speed_offset = 0.0

View File

@ -9,6 +9,7 @@ extends Area2D
export var velocity_pps :float = 1
export var lifespan :float = -1
export var sound_effect :AudioStream
var direction_normal := Vector2(0,0)
puppet var puppet_direction_normal :Vector2
puppet var puppet_position

View File

@ -3,21 +3,26 @@ class_name VelocityController
var velocity :Vector2
var debug :bool = false
const RELATIVE_DIRECTION = 0
const POSITIVE_DIRECTION = 1
const NEGATIVE_DIRECTION = -1
enum RANGE_PLACEMENT {
BEFORE_RANGE = -1,
WITHIN_RANGE = 0,
PAST_RANGE = 1
}
## Side effects for these variables
# velocity - doesn't change but uses it to set base calculations
# accepts the state to determine movement, the deltatime, and an optional direction
# Update: Actually should just return movement in PPS
##
enum IMPULSE_PLACEMENT {
LEFT_SIDE,
RIGHT_SIDE
}
## Could these be datatypes or a class? Sure
var _h_impulse_applied :bool = false
var _h_impulse_speed_tracking :Vector2
var _h_impulse_placement_tracking :int = -1
var _v_impulse_applied :bool = false
var _v_impulse_speed_tracking :Vector2
@ -42,27 +47,31 @@ func calculate_velocity(_delta :float,
## We're now toing to preserve inertia direction
calc_inertia.x = calc_velocity.x
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
# If there is an inertia direction from existing velocity and
# no desired movement we'll continue to travel in that direction.
##
## If an override has been passed (we're ignoring input direction
##TODO: Should preserve initia apply here
var move_direction = Vector2.ZERO
move_direction = resolve_move_direction(calc_inertia, _movement_direction)
# else:
# move_direction = resolve_move_direction(calc_inertia, desired_movement_vector)
## Acceleration is always postive because we use the current inertia
## 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
#var movement_parameters :MovementParameters = _state.get_movement_parameters()
# if modifier and modifier.is_active:
# if (_state.is_grounded and modifier.only_grounded): # Should we skip
# modifier_indicator = '*'
# if _state.name == 'jump':
# var foo = 2+2 # break
# movement_parameters.apply_state_modifier(modifier, move_direction.x)
if sign(move_direction.y) != 0:
calc_acceleration.y = movement_parameters.get_acceleration().y
assert(calc_acceleration.y >= 0, "Negative Y Acceleration shouln't happen")
if is_zero_approx(calc_acceleration.y):
move_direction.y = _movement_direction.y
## Inertia only applies if there is a difference between the
# base move speed and a derived move speed. This makes it so all you
@ -73,125 +82,158 @@ func calculate_velocity(_delta :float,
# is the destination speed.
# We move towards h_speed.y at the acceleration rate
##
var h_speed = resolve_h_speed(movement_parameters)
var v_speed = resolve_v_speed(movement_parameters)
## Speed will now be expected to move in the direction of travel
h_speed *= move_direction.x
v_speed *= move_direction.y
var start_speed :float = (
(movement_parameters.get_speed_start(RELATIVE_DIRECTION).x * move_direction.x) +
(movement_parameters.get_speed_start(POSITIVE_DIRECTION).x * POSITIVE_DIRECTION) +
(movement_parameters.get_speed_start(NEGATIVE_DIRECTION).x * NEGATIVE_DIRECTION)
)
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
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)
## 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
# should only be allowed once.
## Reset the impulse when back in range
# may also want to reset when hspeed is static
if (h_range_placement == RANGE_PLACEMENT.WITHIN_RANGE and
_h_impulse_applied == true ):
if debug:
print("resetting H impulse")
_h_impulse_applied = false
if _h_impulse_applied == true:
if (h_range_placement == RANGE_PLACEMENT.WITHIN_RANGE):
_h_impulse_applied = false
if debug:
print("Resetting H impulse (Within Range)")
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
_v_impulse_applied == true ):
_v_impulse_applied == true and
_v_impulse_speed_tracking != v_speed):
if debug:
print("resetting V impulse")
_v_impulse_applied = false
## Acceleration is always postive because we use the
# move toward functions.
calc_acceleration.x = abs(resolve_h_acceleration(movement_parameters, move_direction.x))
## Separate impulse function
if _h_impulse_applied == false and is_zero_approx(h_speed.x) == false:# and _h_impulse_speed_tracking != h_speed:
#(range_placement :int, inertia :float, impulse_speed_range :Vector2)
#_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':
var foo = 2+2
## We are always moving from h_speed.x towards y at a given rate
## if we have a difference of speed and an acceleration
##TODO: The Min Max could be augmented to just be h_speed.x and prevent the sliding.
if h_speed.x != h_speed.y and calc_acceleration.x != 0.0:
var direction_accel :float = calc_acceleration.x * _delta #* move_direction.x
if h_speed.x > h_speed.y:
direction_accel *= -1
match h_range_placement:
RANGE_PLACEMENT.BEFORE_RANGE:
## Also apply impulse here
if _h_impulse_applied == false:
calc_inertia.x += h_speed.x
_h_impulse_applied = true
#impulse_applied_dir = move_direction.x
calc_inertia.x = clamp(calc_inertia.x + direction_accel,
min(calc_inertia.x, h_speed.y),
max(calc_inertia.x, h_speed.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
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))
elif calc_inertia.x != 0.0 and calc_acceleration.x != 0.0: ## We still have inertia but no difference in movement
if h_speed.x < h_speed.y:
h_speed.x = clamp(h_speed.x,0.0,h_speed.y)
## Move back towards the base speed
calc_inertia.x = move_toward(calc_inertia.x, h_speed.x, calc_acceleration.x * _delta)
if is_zero_approx(calc_acceleration.x) == false:
calc_inertia.x = resolve_inertia(
h_range_placement,
calc_inertia.x ,
h_speed,
(calc_acceleration.x * _delta)
)
else:
## inertia is just base speed
## Using static move directions insteead of inertial move directions
# if is_zero_approx(_movement_direction.x) == false:
# calc_inertia.x = h_speed.x
# else:
# calc_inertia.x = 0.0
calc_inertia.x = h_speed.x
calc_inertial_dir.x = 0.0 # sign(calc_inertia.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))
if debug and movement_parameters.debug_name == 'jump':
var foo = 2+2
if is_zero_approx(calc_acceleration.y) == false:
calc_inertia.y = resolve_inertia(
v_range_placement,
calc_inertia.y ,
v_speed,
(calc_acceleration.y * _delta)
)
else:
## The previous vertical movement methods
calc_inertia.y += movement_parameters.gravity * _delta
## Using static move directions insteead of inertial move directions
# if is_zero_approx(_movement_direction.y) == false:
# calc_inertia.y = v_speed.x
calc_inertia.y = v_speed.x
## Track or last speed for in range impulses
_h_impulse_speed_tracking = h_speed
_v_impulse_speed_tracking = v_speed
# _h_impulse_speed_tracking = h_speed
# _v_impulse_speed_tracking = v_speed
calc_velocity.y = calc_inertia.y
calc_velocity.x = calc_inertia.x
#calc_velocity.y = calc_inertia.y
#calc_velocity.x = calc_inertia.x
if debug:
UiManager.debug_text = ( #"H_Speed x Dir: " + str(h_speed) + str('duh') +
@ -208,7 +250,7 @@ func calculate_velocity(_delta :float,
"\nMoveDir: {0}, {1}".format({"0":"%4.1f" % move_direction.x, "1":"%4.1f" % move_direction.y})
)
return calc_velocity
return calc_inertia
func is_out_of_range(value: float, a: float, b: float) -> bool:
var lower = min(a, b)
@ -224,17 +266,21 @@ func placement_to_speed_range(speed: float, speed_range: Vector2) -> int:
#var range_start :float = min(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
## Direction <-- that way
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
elif speed < speed_range.y:
return RANGE_PLACEMENT.PAST_RANGE
else:
return RANGE_PLACEMENT.BEFORE_RANGE
else: ## Direction --> that way
if speed > speed_range.x and speed <= speed_range.y:
if speed > speed_range.x and speed < speed_range.y:
return RANGE_PLACEMENT.WITHIN_RANGE
elif speed > speed_range.y:
return RANGE_PLACEMENT.PAST_RANGE
@ -242,54 +288,6 @@ func placement_to_speed_range(speed: float, speed_range: Vector2) -> int:
return RANGE_PLACEMENT.BEFORE_RANGE
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,
_movement_direction :Vector2) -> Vector2:
@ -306,3 +304,79 @@ func resolve_move_direction(_momentum :Vector2,
vertical_movement_direction = sign(_momentum.y)
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

View File

@ -62,8 +62,10 @@ func shoot(direction = 1):
bullet.set_as_toplevel(true)
add_child(bullet)
# sound_shoot.play()
timer.start()
SoundEffectManager.play_sound(bullet.sound_effect)
NetworkManager.instance_on_peer_players(loaded_scene, self.get_path(), global_position , true)
return true

View File

@ -1,17 +1,12 @@
[gd_scene load_steps=9 format=2]
[gd_scene load_steps=6 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="CloneBox" groups=["world"] instance=ExtResource( 1 )]
[node name="TileMap Background" parent="." index="0"]
@ -19,7 +14,7 @@ z_index = -2
[node name="TileMap Collision" parent="." index="1"]
tile_set = ExtResource( 2 )
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 )
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 )
[node name="TileMap Foreground" parent="." index="2"]
tile_set = ExtResource( 2 )
@ -31,10 +26,13 @@ tile_data = PoolIntArray( 524288, 0, 2, 524307, 0, 3 )
position = Vector2( 50, 131 )
[node name="EnterLeft" type="Position2D" parent="." index="4"]
position = Vector2( -13, 28 )
position = Vector2( -14, 44 )
[node name="LevelTransition" parent="." index="5" instance=ExtResource( 4 )]
position = Vector2( -12, 31 )
[node name="EnterRight" type="Position2D" parent="." index="5"]
position = Vector2( 332, 44 )
[node name="LevelTransition" parent="." index="6" instance=ExtResource( 4 )]
position = Vector2( -13, 47 )
_transition_type = "door_left"
_destination_level = "res://src/levels/TestBox.tscn"
_destination_position_name = "EnterRight"
@ -46,10 +44,10 @@ __meta__ = {
"_edit_lock_": true
}
[node name="LevelTransition2" parent="." index="6" instance=ExtResource( 4 )]
position = Vector2( 332, 31 )
_destination_level = "res://src/levels/TestBox.tscn"
_destination_position_name = "EnterRight"
[node name="LevelTransition2" parent="." index="7" instance=ExtResource( 4 )]
position = Vector2( 331, 47 )
_destination_level = "res://src/levels/TC_01.tscn"
_destination_position_name = "EnterLeft"
[node name="CollisionShape2D" type="CollisionShape2D" parent="LevelTransition2" index="0"]
modulate = Color( 1, 0, 1, 1 )
@ -58,23 +56,16 @@ __meta__ = {
"_edit_lock_": true
}
[node name="Camera Bounds" parent="." index="7"]
[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="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"]
modulate = Color( 0.501961, 0.501961, 0.501961, 1 )
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"
text = "CB"
align = 1
valign = 1

84
src/levels/TC_01.tscn Normal file
View File

@ -0,0 +1,84 @@
[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

84
src/levels/TC_02.tscn Normal file
View File

@ -0,0 +1,84 @@
[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

85
src/levels/TC_03.tscn Normal file
View File

@ -0,0 +1,85 @@
[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

View File

@ -1,7 +1,8 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=5 format=2]
[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_tmp/SE/pop.wav" type="AudioStream" id=3]
[sub_resource type="CapsuleShape2D" id=1]
radius = 6.0
@ -10,6 +11,7 @@ height = 2.0
[node name="MushroomPew" groups=["world"] instance=ExtResource( 1 )]
velocity_pps = 300.0
lifespan = 0.5
sound_effect = ExtResource( 3 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="0"]
shape = SubResource( 1 )