Compare commits
No commits in common. "95c217be5c22db87e4918a61495c7cb5dada84e5" and "d1d33f30878ae79521edb8eaa66213e54cd7025d" have entirely different histories.
95c217be5c
...
d1d33f3087
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[ext_resource path="res://src/classes/camera_guide.gd" type="Script" id=1]
|
[ext_resource path="res://src/classes/camera_guide.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://src/Camera2D.gd" type="Script" id=2]
|
[ext_resource path="res://src/Camera2D.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://src/levels/CloneBox.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://src/levels/TestBox.tscn" type="PackedScene" id=3]
|
||||||
[ext_resource path="res://src/ui/scene_transition.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://src/ui/scene_transition.tscn" type="PackedScene" id=4]
|
||||||
[ext_resource path="res://src/ui/HUD.tscn" type="PackedScene" id=5]
|
[ext_resource path="res://src/ui/HUD.tscn" type="PackedScene" id=5]
|
||||||
[ext_resource path="res://src/Main.gd" type="Script" id=7]
|
[ext_resource path="res://src/Main.gd" type="Script" id=7]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
[gd_resource type="Theme" load_steps=2 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://assets/Fonts/QuinqueFive.tres" type="DynamicFont" id=1]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
default_font = ExtResource( 1 )
|
|
||||||
|
|
@ -9,10 +9,6 @@ export var move_speed_modifier_acceleration :Vector2
|
||||||
|
|
||||||
var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity")
|
var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity")
|
||||||
var jerk: float = 0.0
|
var jerk: float = 0.0
|
||||||
|
|
||||||
## 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_speed :float
|
||||||
# export var base_h_move_acceleration :float
|
# export var base_h_move_acceleration :float
|
||||||
# export var h_move_speed_modifier :float
|
# export var h_move_speed_modifier :float
|
||||||
|
|
@ -31,6 +27,8 @@ func apply_state_modifier(_modifier :StateModifierMovement):
|
||||||
StateModifierMovement.SUB_TYPE.NEGATIVE_CONSTRAINT:
|
StateModifierMovement.SUB_TYPE.NEGATIVE_CONSTRAINT:
|
||||||
var adjusted_move_speed = base_move_speed.x + _modifier.horizontal_speed
|
var adjusted_move_speed = base_move_speed.x + _modifier.horizontal_speed
|
||||||
## We crossed the zero from the base
|
## We crossed the zero from the base
|
||||||
|
if base_move_speed.x == 10:
|
||||||
|
var foo = 2+2
|
||||||
if sign(adjusted_move_speed) != sign(base_move_speed.x):
|
if sign(adjusted_move_speed) != sign(base_move_speed.x):
|
||||||
base_move_speed.x = 0.0
|
base_move_speed.x = 0.0
|
||||||
else:
|
else:
|
||||||
|
|
@ -42,14 +40,7 @@ func apply_state_modifier(_modifier :StateModifierMovement):
|
||||||
base_move_acceleration.x = adjusted_accel
|
base_move_acceleration.x = adjusted_accel
|
||||||
|
|
||||||
##TODO: Um, modifiers are a little weirder for this
|
##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.x += _modifier.horizontal_speed_offset
|
||||||
|
|
||||||
move_speed_modifier_acceleration.x += _modifier.horizontal_speed_offset_acceleration
|
move_speed_modifier_acceleration.x += _modifier.horizontal_speed_offset_acceleration
|
||||||
move_speed_modifier.y += _modifier.vertical_speed_offset
|
move_speed_modifier.y += _modifier.vertical_speed_offset
|
||||||
move_speed_modifier_acceleration.y += _modifier.vertical_speed_offset_acceleration
|
move_speed_modifier_acceleration.y += _modifier.vertical_speed_offset_acceleration
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ onready var desired_movement_vector: Vector2 = Vector2(0,0)
|
||||||
# Since animactor state machine can actually view properties from this type
|
# Since animactor state machine can actually view properties from this type
|
||||||
# I'm thinking about moving the velocity tracker in here instead of player.
|
# I'm thinking about moving the velocity tracker in here instead of player.
|
||||||
#var velocity = Vector2(0,0)
|
#var velocity = Vector2(0,0)
|
||||||
var velocity_controller :VelocityController = VelocityController.new()
|
var velocity :VelocityCalculations = VelocityCalculations.new()
|
||||||
|
|
||||||
#Removing Probably not used
|
#Removing Probably not used
|
||||||
#var sim_velocity = Vector2(0,0)
|
#var sim_velocity = Vector2(0,0)
|
||||||
|
|
@ -40,7 +40,7 @@ const LEFT = -1.0
|
||||||
const RIGHT = 1.0
|
const RIGHT = 1.0
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
velocity_controller.debug = true
|
#velocity.debug = true
|
||||||
|
|
||||||
## FuncRef to request state machine change state
|
## FuncRef to request state machine change state
|
||||||
request_state_change = funcref(get_node(callable_state_machine), 'change_to_known_state')
|
request_state_change = funcref(get_node(callable_state_machine), 'change_to_known_state')
|
||||||
|
|
@ -159,5 +159,5 @@ func apply_movement_to_parent( _velocity :Vector2) -> void:
|
||||||
if _velocity.y < -8:
|
if _velocity.y < -8:
|
||||||
snap = Vector2.ZERO
|
snap = Vector2.ZERO
|
||||||
if parent is KinematicBody2D:
|
if parent is KinematicBody2D:
|
||||||
velocity_controller.velocity = parent.move_and_slide_with_snap(_velocity, snap , Vector2.UP, true)
|
velocity.velocity = parent.move_and_slide_with_snap(_velocity, snap , Vector2.UP, true)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,6 @@ func enter() -> void:
|
||||||
|
|
||||||
func get_movement_parameters() -> MovementParameters:
|
func get_movement_parameters() -> MovementParameters:
|
||||||
var movement_parameters = MovementParameters.new()
|
var movement_parameters = MovementParameters.new()
|
||||||
movement_parameters.debug_name = name
|
|
||||||
movement_parameters.base_move_speed.x = horizontal_speed
|
movement_parameters.base_move_speed.x = horizontal_speed
|
||||||
movement_parameters.base_move_acceleration.x = horizontal_acceleration
|
movement_parameters.base_move_acceleration.x = horizontal_acceleration
|
||||||
movement_parameters.move_speed_modifier.x = horizontal_speed_offset
|
movement_parameters.move_speed_modifier.x = horizontal_speed_offset
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
class_name StateModifier
|
class_name StateModifier
|
||||||
extends Resource
|
extends Reference
|
||||||
## State modification
|
## State modification
|
||||||
##
|
##
|
||||||
## A state modifier doesn't have any direct control of a game object.
|
## A state modifier doesn't have any direct control of a game object.
|
||||||
|
|
@ -33,7 +33,7 @@ var debug: bool = false
|
||||||
## the state animation. Or perform a 'Replace Animation'
|
## the state animation. Or perform a 'Replace Animation'
|
||||||
var modifier_type = TYPE.NONE
|
var modifier_type = TYPE.NONE
|
||||||
|
|
||||||
export var name :String = ''
|
var name :String = ''
|
||||||
#var ready :bool = false
|
#var ready :bool = false
|
||||||
var is_active: bool = false
|
var is_active: bool = false
|
||||||
|
|
||||||
|
|
@ -64,7 +64,7 @@ signal modifier_event(event_id )
|
||||||
#var animation_sequence_timer: Timer
|
#var animation_sequence_timer: Timer
|
||||||
|
|
||||||
var timeout: Timer
|
var timeout: Timer
|
||||||
export var timeout_seconds: float = 0.0
|
var timeout_seconds: float = 0.0
|
||||||
|
|
||||||
# Meant to be called on timeout or other counters this modifier may have.
|
# Meant to be called on timeout or other counters this modifier may have.
|
||||||
# Should be updated whenever modifier owner transfers
|
# Should be updated whenever modifier owner transfers
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ extends StateModifier
|
||||||
|
|
||||||
## Animation modifier variables
|
## Animation modifier variables
|
||||||
## The name of the animation that could be applied and starting frame
|
## The name of the animation that could be applied and starting frame
|
||||||
export var animation_name: String = ''
|
var animation_name: String = ''
|
||||||
export var animation_suffix: String = ''
|
var animation_suffix: String = ''
|
||||||
export var animation_starting_frame: int = 0
|
var animation_starting_frame: int = 0
|
||||||
export var animation_speed: float
|
var animation_speed: float
|
||||||
|
|
||||||
enum SUB_TYPE {
|
enum SUB_TYPE {
|
||||||
NONE, # Usually just a physics modifier
|
NONE, # Usually just a physics modifier
|
||||||
|
|
|
||||||
|
|
@ -2,26 +2,26 @@ class_name StateModifierMovement
|
||||||
extends StateModifier
|
extends StateModifier
|
||||||
|
|
||||||
## Movement Modifiers
|
## Movement Modifiers
|
||||||
export var horizontal_speed: float = 0
|
var horizontal_speed: float = 0
|
||||||
export var horizontal_acceleration: float = 0
|
var horizontal_acceleration: float = 0
|
||||||
## Movement Speed Offsets (Positive or Negative)
|
## Movement Speed Offsets (Positive or Negative)
|
||||||
export var horizontal_speed_offset: float = 0
|
var horizontal_speed_offset: float = 0
|
||||||
## Applies only if offset applies
|
## Applies only if offset applies
|
||||||
export var horizontal_speed_offset_acceleration: float = 0
|
var horizontal_speed_offset_acceleration: float = 0
|
||||||
export var jerk_factor: float = 0
|
var jerk_factor: float = 0
|
||||||
|
|
||||||
export var vertical_speed: float = 0
|
var vertical_speed: float = 0
|
||||||
export var vertical_acceleration: float = 0
|
var vertical_acceleration: float = 0
|
||||||
## Movement Speed Offsets (Positive or Negative)
|
## Movement Speed Offsets (Positive or Negative)
|
||||||
export var vertical_speed_offset: float = 0
|
var vertical_speed_offset: float = 0
|
||||||
## Applies only if offset applies
|
## Applies only if offset applies
|
||||||
export var vertical_speed_offset_acceleration: float = 0
|
var vertical_speed_offset_acceleration: float = 0
|
||||||
|
|
||||||
export var gravity: int = 0
|
var gravity: int = 0
|
||||||
|
|
||||||
## Processing Directives (help determine how the merge function works)
|
## Processing Directives (help determine how the merge function works)
|
||||||
var direction :float = 0.0 # -1, 0, 1
|
var direction :float = 0.0 # -1, 0, 1
|
||||||
export var only_grounded :float = false
|
var only_grounded :float = false
|
||||||
|
|
||||||
enum SUB_TYPE {
|
enum SUB_TYPE {
|
||||||
NONE, # Basic physics modifier just adds numbers
|
NONE, # Basic physics modifier just adds numbers
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
extends Area2D
|
extends Area2D
|
||||||
|
|
||||||
export var modifier :Resource
|
|
||||||
|
|
||||||
var modifier_type = 0
|
var modifier_type = 0
|
||||||
|
|
||||||
|
export var modifier_name :String = ''
|
||||||
|
var animation_name: String = '' # Not using this one
|
||||||
|
var timeout_seconds: float = 0.0 # Not doing timeout based ones yet either.
|
||||||
|
|
||||||
|
export var directional_modifier: bool = false
|
||||||
|
|
||||||
|
export var move_speed: float = 0.0
|
||||||
|
export var move_acceleration: float = 0.0
|
||||||
|
export var move_speed_modifier: float = 0.0
|
||||||
|
export var move_modifier_move_acceleration: float = 0.0
|
||||||
|
export var jerk_factor: float = 0
|
||||||
|
|
||||||
|
export var gravity_modifier: int = 0
|
||||||
|
|
||||||
#var state_timeout: Timer
|
#var state_timeout: Timer
|
||||||
|
|
||||||
|
|
@ -11,21 +23,22 @@ var modifier_type = 0
|
||||||
# var a = 2
|
# var a = 2
|
||||||
# var b = "text"
|
# var b = "text"
|
||||||
|
|
||||||
#var modifier :StateModifier
|
var modifier :StateModifier
|
||||||
#var modifier_properties: ModifierProperties
|
#var modifier_properties: ModifierProperties
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
assert(modifier is StateModifier)
|
modifier = StateModifier.new()
|
||||||
# modifier = StateModifier.new()
|
modifier.ready( modifier_name, animation_name , modifier.TYPE.NONE, timeout_seconds)
|
||||||
# modifier.ready( modifier_name, animation_name , modifier.TYPE.NONE, timeout_seconds)
|
modifier.modifier_properties = ModifierProperties.new( move_speed,
|
||||||
# modifier.modifier_properties = ModifierProperties.new( move_speed,
|
gravity_modifier,
|
||||||
# gravity_modifier,
|
move_acceleration,
|
||||||
# move_acceleration,
|
move_speed_modifier,
|
||||||
# move_speed_modifier,
|
move_modifier_move_acceleration,
|
||||||
# move_modifier_move_acceleration,
|
jerk_factor)
|
||||||
# jerk_factor)
|
print("Debug Direction property shy are you stopid?! ", directional_modifier)
|
||||||
|
modifier.modifier_properties.directional_modifier = directional_modifier
|
||||||
|
|
||||||
func _on_Modifier_Component_body_entered(body):
|
func _on_Modifier_Component_body_entered(body):
|
||||||
var colliding_node = body
|
var colliding_node = body
|
||||||
|
|
|
||||||
|
|
@ -11,16 +11,14 @@ extends Node2D
|
||||||
# This node can keep an array of various interactibles within a level
|
# This node can keep an array of various interactibles within a level
|
||||||
# and provide several helper functions for managing them perhaps.
|
# and provide several helper functions for managing them perhaps.
|
||||||
|
|
||||||
export var enabled :bool = true
|
export(String) var modifier_parent_callback = ""
|
||||||
|
|
||||||
export var callable_state_machine :NodePath
|
|
||||||
var request_push_state_modifier: FuncRef
|
|
||||||
|
|
||||||
export var debug_receiver :bool = false
|
export var debug_receiver :bool = false
|
||||||
|
|
||||||
|
var call_function: FuncRef
|
||||||
|
|
||||||
|
#var interactable_function_callables = []
|
||||||
|
|
||||||
|
var modifier_collection = []
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
# Declare member variables here. Examples:
|
||||||
# var a = 2
|
# var a = 2
|
||||||
|
|
@ -32,28 +30,24 @@ export var debug_receiver :bool = false
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
assert(callable_state_machine != null)
|
if modifier_parent_callback:
|
||||||
|
call_function = funcref(owner, modifier_parent_callback)
|
||||||
## FuncRef to request state machine change state
|
else:
|
||||||
request_push_state_modifier = funcref(get_node(callable_state_machine), 'push_state_modifier')
|
print("Warning: No modifier receiver function defined on ", owner.name)
|
||||||
assert(request_push_state_modifier.is_valid())
|
|
||||||
|
|
||||||
|
|
||||||
# Switching to a new model that starts with Hitbox
|
# Switching to a new model that starts with Hitbox
|
||||||
func register_modifier(modifier: StateModifier):
|
func register_modifier(modifier: StateModifier):
|
||||||
if enabled:
|
if modifier_collection.has(modifier) == false:
|
||||||
request_push_state_modifier.call_func(modifier)
|
print("New Modifier Registered " + modifier.name)
|
||||||
# if modifier_collection.has(modifier) == false:
|
modifier_collection.append(modifier)
|
||||||
# print("New Modifier Registered " + modifier.name)
|
if call_function.is_valid():
|
||||||
# modifier_collection.append(modifier)
|
call_function.call_func(modifier, true)
|
||||||
# if call_function.is_valid():
|
|
||||||
# call_function.call_func(modifier, true)
|
|
||||||
|
|
||||||
func remove_modifier(modifier):
|
func remove_modifier(modifier):
|
||||||
print("Modifier Removal not implemented here." + modifier.name)
|
print("Modifier Removal " + modifier.name)
|
||||||
# if modifier_collection.has(modifier):
|
if modifier_collection.has(modifier):
|
||||||
# var modifier_index = modifier_collection.rfind(modifier)
|
var modifier_index = modifier_collection.rfind(modifier)
|
||||||
# if modifier_index != -1:
|
if modifier_index != -1:
|
||||||
# modifier_collection.remove(modifier_index)
|
modifier_collection.remove(modifier_index)
|
||||||
# if call_function.is_valid():
|
if call_function.is_valid():
|
||||||
# call_function.call_func(modifier, false)
|
call_function.call_func(modifier, false)
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ _global_script_classes=[ {
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://lib/classes/state_machine_animated_actor.gd"
|
"path": "res://lib/classes/state_machine_animated_actor.gd"
|
||||||
}, {
|
}, {
|
||||||
"base": "Resource",
|
"base": "Reference",
|
||||||
"class": "StateModifier",
|
"class": "StateModifier",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://lib/classes/state_modifier.gd"
|
"path": "res://lib/classes/state_modifier.gd"
|
||||||
|
|
@ -165,9 +165,9 @@ _global_script_classes=[ {
|
||||||
"path": "res://src/ui/HUD.gd"
|
"path": "res://src/ui/HUD.gd"
|
||||||
}, {
|
}, {
|
||||||
"base": "Reference",
|
"base": "Reference",
|
||||||
"class": "VelocityController",
|
"class": "VelocityCalculations",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://src/classes/velocity_controller.gd"
|
"path": "res://src/classes/velocity_calculations.gd"
|
||||||
} ]
|
} ]
|
||||||
_global_script_class_icons={
|
_global_script_class_icons={
|
||||||
"Actor": "",
|
"Actor": "",
|
||||||
|
|
@ -201,7 +201,7 @@ _global_script_class_icons={
|
||||||
"StateModifierAnimatedActor": "",
|
"StateModifierAnimatedActor": "",
|
||||||
"StateModifierMovement": "",
|
"StateModifierMovement": "",
|
||||||
"UIComponent": "",
|
"UIComponent": "",
|
||||||
"VelocityController": ""
|
"VelocityCalculations": ""
|
||||||
}
|
}
|
||||||
|
|
||||||
[application]
|
[application]
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
[gd_resource type="Resource" load_steps=2 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://lib/classes/state_modifier_movement.gd" type="Script" id=1]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
resource_local_to_scene = true
|
|
||||||
resource_name = "ice"
|
|
||||||
script = ExtResource( 1 )
|
|
||||||
name = "ice_or_something"
|
|
||||||
timeout_seconds = 0.0
|
|
||||||
horizontal_speed = 0.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
|
|
||||||
gravity = 0
|
|
||||||
only_grounded = 0.0
|
|
||||||
|
|
@ -163,7 +163,7 @@ func _state_process_physics_idle():
|
||||||
# var _v :Vector2 = new_move_actor_as_desired( physics_delta , current_state )
|
# var _v :Vector2 = new_move_actor_as_desired( physics_delta , current_state )
|
||||||
# apply_movement_to_parent(_v)
|
# apply_movement_to_parent(_v)
|
||||||
apply_movement_to_parent(
|
apply_movement_to_parent(
|
||||||
velocity_controller.calculate_velocity(
|
velocity.calculate_velocity(
|
||||||
physics_delta ,
|
physics_delta ,
|
||||||
apply_state_modifier(current_state.get_movement_parameters()),
|
apply_state_modifier(current_state.get_movement_parameters()),
|
||||||
desired_movement_vector )
|
desired_movement_vector )
|
||||||
|
|
@ -228,7 +228,7 @@ func _state_process_physics_roll():
|
||||||
#move_actor_as_desired(parent.transform.x.x)
|
#move_actor_as_desired(parent.transform.x.x)
|
||||||
#apply_movement_to_parent(new_move_actor_as_desired( physics_delta , current_state, parent.transform.x ))
|
#apply_movement_to_parent(new_move_actor_as_desired( physics_delta , current_state, parent.transform.x ))
|
||||||
apply_movement_to_parent(
|
apply_movement_to_parent(
|
||||||
velocity_controller.calculate_velocity(
|
velocity.calculate_velocity(
|
||||||
physics_delta ,
|
physics_delta ,
|
||||||
apply_state_modifier(current_state.get_movement_parameters()),
|
apply_state_modifier(current_state.get_movement_parameters()),
|
||||||
parent.transform.x )
|
parent.transform.x )
|
||||||
|
|
@ -263,7 +263,7 @@ func _state_process_physics_enter_right():
|
||||||
# instead of movement direction
|
# instead of movement direction
|
||||||
#move_actor_as_desired(parent.transform.x.x)
|
#move_actor_as_desired(parent.transform.x.x)
|
||||||
apply_movement_to_parent(
|
apply_movement_to_parent(
|
||||||
velocity_controller.calculate_velocity(
|
velocity.calculate_velocity(
|
||||||
physics_delta ,
|
physics_delta ,
|
||||||
apply_state_modifier(current_state.get_movement_parameters()),
|
apply_state_modifier(current_state.get_movement_parameters()),
|
||||||
parent.transform.x )
|
parent.transform.x )
|
||||||
|
|
@ -279,7 +279,7 @@ func _state_process_physics_land():
|
||||||
request_state_change.call_func('fall')
|
request_state_change.call_func('fall')
|
||||||
#move_actor_as_desired()
|
#move_actor_as_desired()
|
||||||
apply_movement_to_parent(
|
apply_movement_to_parent(
|
||||||
velocity_controller.calculate_velocity(
|
velocity.calculate_velocity(
|
||||||
physics_delta ,
|
physics_delta ,
|
||||||
apply_state_modifier(current_state.get_movement_parameters()),
|
apply_state_modifier(current_state.get_movement_parameters()),
|
||||||
desired_movement_vector )
|
desired_movement_vector )
|
||||||
|
|
@ -292,14 +292,14 @@ func _state_process_physics_hurt():
|
||||||
# if !parent.is_on_floor():
|
# if !parent.is_on_floor():
|
||||||
# #return fall_state
|
# #return fall_state
|
||||||
# request_state_change.call_func('fall')
|
# request_state_change.call_func('fall')
|
||||||
velocity_controller.velocity.y += current_state.gravity * physics_delta
|
velocity.y += current_state.gravity * physics_delta
|
||||||
#parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1))
|
#parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1))
|
||||||
velocity_controller.velocity.x = parent.transform.x.x * -1 * current_state.horizontal_speed
|
velocity.x = parent.transform.x.x * -1 * current_state.horizontal_speed
|
||||||
# if (parent.direction.x > 0):
|
# if (parent.direction.x > 0):
|
||||||
# parent.velocity.x = 1 * move_speed
|
# parent.velocity.x = 1 * move_speed
|
||||||
# else:
|
# else:
|
||||||
# parent.velocity.x = -1 * move_speed
|
# parent.velocity.x = -1 * move_speed
|
||||||
velocity_controller.velocity = parent.move_and_slide(velocity_controller.velocity, Vector2(0, -1))
|
velocity.velocity = parent.move_and_slide(velocity.velocity, Vector2(0, -1))
|
||||||
|
|
||||||
|
|
||||||
func _state_process_physics_fall():
|
func _state_process_physics_fall():
|
||||||
|
|
@ -318,7 +318,7 @@ func _state_process_physics_fall():
|
||||||
|
|
||||||
#move_actor_as_desired()
|
#move_actor_as_desired()
|
||||||
apply_movement_to_parent(
|
apply_movement_to_parent(
|
||||||
velocity_controller.calculate_velocity(
|
velocity.calculate_velocity(
|
||||||
physics_delta ,
|
physics_delta ,
|
||||||
apply_state_modifier(current_state.get_movement_parameters()),
|
apply_state_modifier(current_state.get_movement_parameters()),
|
||||||
desired_movement_vector )
|
desired_movement_vector )
|
||||||
|
|
@ -333,12 +333,12 @@ func _state_process_physics_jump():
|
||||||
# #modifier.reference()
|
# #modifier.reference()
|
||||||
# #idle_state.modifier = landing_modifier
|
# #idle_state.modifier = landing_modifier
|
||||||
# request_state_change.call_func('idle')
|
# request_state_change.call_func('idle')
|
||||||
if velocity_controller.velocity.y > 0:
|
if velocity.velocity.y > 0:
|
||||||
request_state_change.call_func('fall')
|
request_state_change.call_func('fall')
|
||||||
desired_movement_vector.y = UP
|
desired_movement_vector.y = UP
|
||||||
#move_actor_as_desired()
|
#move_actor_as_desired()
|
||||||
apply_movement_to_parent(
|
apply_movement_to_parent(
|
||||||
velocity_controller.calculate_velocity(
|
velocity.calculate_velocity(
|
||||||
physics_delta ,
|
physics_delta ,
|
||||||
apply_state_modifier(current_state.get_movement_parameters()),
|
apply_state_modifier(current_state.get_movement_parameters()),
|
||||||
desired_movement_vector )
|
desired_movement_vector )
|
||||||
|
|
@ -366,7 +366,7 @@ func _state_process_physics_move():
|
||||||
|
|
||||||
#apply_movement_to_parent(new_move_actor_as_desired( physics_delta , current_state ))
|
#apply_movement_to_parent(new_move_actor_as_desired( physics_delta , current_state ))
|
||||||
apply_movement_to_parent(
|
apply_movement_to_parent(
|
||||||
velocity_controller.calculate_velocity(
|
velocity.calculate_velocity(
|
||||||
physics_delta ,
|
physics_delta ,
|
||||||
apply_state_modifier(current_state.get_movement_parameters()),
|
apply_state_modifier(current_state.get_movement_parameters()),
|
||||||
desired_movement_vector )
|
desired_movement_vector )
|
||||||
|
|
@ -415,7 +415,7 @@ func _state_process_physics_climb():
|
||||||
|
|
||||||
func _state_process_physics_ledge_grab():
|
func _state_process_physics_ledge_grab():
|
||||||
if debug_component:
|
if debug_component:
|
||||||
UiManager.debug_text = (str(velocity_controller.velocity))
|
UiManager.debug_text = (str(velocity))
|
||||||
$"%LedgeDetector".set_enabled(false)
|
$"%LedgeDetector".set_enabled(false)
|
||||||
|
|
||||||
if _wants_jump:
|
if _wants_jump:
|
||||||
|
|
@ -429,7 +429,7 @@ func _state_process_physics_ledge_climb():
|
||||||
|
|
||||||
if debug_component:
|
if debug_component:
|
||||||
UiManager.debug_text = (str(parent.is_on_floor()) +
|
UiManager.debug_text = (str(parent.is_on_floor()) +
|
||||||
str(parent.is_on_wall()) + ")\nV:" + str(velocity_controller.velocity))
|
str(parent.is_on_wall()) + ")\nV:" + str(velocity))
|
||||||
|
|
||||||
if current_state.animation_finished == true:
|
if current_state.animation_finished == true:
|
||||||
request_state_change.call_func('land')
|
request_state_change.call_func('land')
|
||||||
|
|
@ -482,7 +482,7 @@ func _state_process_physics_crouch_move():
|
||||||
|
|
||||||
#move_actor_as_desired()
|
#move_actor_as_desired()
|
||||||
apply_movement_to_parent(
|
apply_movement_to_parent(
|
||||||
velocity_controller.calculate_velocity(
|
velocity.calculate_velocity(
|
||||||
physics_delta ,
|
physics_delta ,
|
||||||
apply_state_modifier(current_state.get_movement_parameters()),
|
apply_state_modifier(current_state.get_movement_parameters()),
|
||||||
desired_movement_vector )
|
desired_movement_vector )
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ const state_stamina_cost :Dictionary = {
|
||||||
"jump": 10,
|
"jump": 10,
|
||||||
"attack_sword":20,
|
"attack_sword":20,
|
||||||
"attack_punch":10,
|
"attack_punch":10,
|
||||||
#"roll":40,
|
"roll":40,
|
||||||
"roll":4,
|
#"roll":4,
|
||||||
"ledge_climb":10
|
"ledge_climb":10
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=43 format=2]
|
[gd_scene load_steps=42 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://lib/parent_scenes/actor.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://lib/parent_scenes/actor.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://assets/actors/players/playerE/PlayerE_SpriteFrames.tres" type="SpriteFrames" id=2]
|
[ext_resource path="res://assets/actors/players/playerE/PlayerE_SpriteFrames.tres" type="SpriteFrames" id=2]
|
||||||
|
|
@ -34,7 +34,6 @@
|
||||||
[ext_resource path="res://src/actors/players/playerE/Hitbox-CollisionShape2D_StateReceiver.gd" type="Script" id=32]
|
[ext_resource path="res://src/actors/players/playerE/Hitbox-CollisionShape2D_StateReceiver.gd" type="Script" id=32]
|
||||||
[ext_resource path="res://lib/components/Hitbox_Component.tscn" type="PackedScene" id=33]
|
[ext_resource path="res://lib/components/Hitbox_Component.tscn" type="PackedScene" id=33]
|
||||||
[ext_resource path="res://src/actors/players/playerE/Hurtbox-CollisionShape2D_StateReceiver.gd" type="Script" id=34]
|
[ext_resource path="res://src/actors/players/playerE/Hurtbox-CollisionShape2D_StateReceiver.gd" type="Script" id=34]
|
||||||
[ext_resource path="res://lib/components/Modifier_Receiver.tscn" type="PackedScene" id=35]
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id=3]
|
[sub_resource type="Resource" id=3]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
|
|
@ -47,12 +46,6 @@ horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
jerk_factor = 0.0
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
|
||||||
vertical_acceleration = 0.0
|
|
||||||
vertical_speed_offset = 0.0
|
|
||||||
vertical_speed_offset_acceleration = 0.0
|
|
||||||
preserve_inertia = true
|
|
||||||
is_grounded = true
|
|
||||||
animation_sequence = [ "hurt" ]
|
animation_sequence = [ "hurt" ]
|
||||||
|
|
||||||
[sub_resource type="Resource" id=4]
|
[sub_resource type="Resource" id=4]
|
||||||
|
|
@ -116,25 +109,21 @@ __meta__ = {
|
||||||
[node name="Movement_StateReceiver" parent="." index="2"]
|
[node name="Movement_StateReceiver" parent="." index="2"]
|
||||||
script = ExtResource( 6 )
|
script = ExtResource( 6 )
|
||||||
|
|
||||||
[node name="Modifier_Receiver" parent="." index="3" instance=ExtResource( 35 )]
|
[node name="LedgeDetector" type="RayCast2D" parent="." index="3"]
|
||||||
callable_state_machine = NodePath("../Movement_StateMachine")
|
|
||||||
debug_receiver = true
|
|
||||||
|
|
||||||
[node name="LedgeDetector" type="RayCast2D" parent="." index="4"]
|
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
modulate = Color( 0, 1, 0, 1 )
|
modulate = Color( 0, 1, 0, 1 )
|
||||||
position = Vector2( 8, -10 )
|
position = Vector2( 8, -10 )
|
||||||
enabled = true
|
enabled = true
|
||||||
cast_to = Vector2( 1.36422e-12, -1 )
|
cast_to = Vector2( 1.36422e-12, -1 )
|
||||||
|
|
||||||
[node name="WallDetector" type="RayCast2D" parent="." index="5"]
|
[node name="WallDetector" type="RayCast2D" parent="." index="4"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
modulate = Color( 0, 1, 0, 1 )
|
modulate = Color( 0, 1, 0, 1 )
|
||||||
position = Vector2( 6, -16 )
|
position = Vector2( 6, -16 )
|
||||||
enabled = true
|
enabled = true
|
||||||
cast_to = Vector2( 4, 4 )
|
cast_to = Vector2( 4, 4 )
|
||||||
|
|
||||||
[node name="LadderDetector" type="RayCast2D" parent="." index="6"]
|
[node name="LadderDetector" type="RayCast2D" parent="." index="5"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
modulate = Color( 0, 1, 0, 1 )
|
modulate = Color( 0, 1, 0, 1 )
|
||||||
enabled = true
|
enabled = true
|
||||||
|
|
@ -143,25 +132,25 @@ collision_mask = 1024
|
||||||
collide_with_areas = true
|
collide_with_areas = true
|
||||||
collide_with_bodies = false
|
collide_with_bodies = false
|
||||||
|
|
||||||
[node name="AudioStreamPlayer_StateReceiver" parent="." index="7"]
|
[node name="AudioStreamPlayer_StateReceiver" parent="." index="6"]
|
||||||
sound_effects = [ SubResource( 4 ), SubResource( 5 ), SubResource( 6 ) ]
|
sound_effects = [ SubResource( 4 ), SubResource( 5 ), SubResource( 6 ) ]
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="8"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="7"]
|
||||||
position = Vector2( 0, 2 )
|
position = Vector2( 0, 2 )
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
script = ExtResource( 31 )
|
script = ExtResource( 31 )
|
||||||
callable_state_machine = NodePath("../Movement_StateMachine")
|
callable_state_machine = NodePath("../Movement_StateMachine")
|
||||||
|
|
||||||
[node name="Health_Component" parent="." index="9" instance=ExtResource( 17 )]
|
[node name="Health_Component" parent="." index="8" instance=ExtResource( 17 )]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
max_health = 100
|
max_health = 100
|
||||||
|
|
||||||
[node name="Stamina_Component" parent="." index="10" instance=ExtResource( 29 )]
|
[node name="Stamina_Component" parent="." index="9" instance=ExtResource( 29 )]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
max_stamina = 50
|
max_stamina = 50
|
||||||
recovery_rate = 2
|
recovery_rate = 2
|
||||||
|
|
||||||
[node name="Hurtbox_Component" parent="." index="11" instance=ExtResource( 16 )]
|
[node name="Hurtbox_Component" parent="." index="10" instance=ExtResource( 16 )]
|
||||||
collision_layer = 16
|
collision_layer = 16
|
||||||
collision_mask = 128
|
collision_mask = 128
|
||||||
hurtbox_entered_function = "hit_Receiver"
|
hurtbox_entered_function = "hit_Receiver"
|
||||||
|
|
@ -173,13 +162,13 @@ shape = SubResource( 2 )
|
||||||
script = ExtResource( 34 )
|
script = ExtResource( 34 )
|
||||||
callable_state_machine = NodePath("../../Movement_StateMachine")
|
callable_state_machine = NodePath("../../Movement_StateMachine")
|
||||||
|
|
||||||
[node name="Interactable_Receiver" type="Node" parent="." index="12"]
|
[node name="Interactable_Receiver" type="Node" parent="." index="11"]
|
||||||
script = ExtResource( 21 )
|
script = ExtResource( 21 )
|
||||||
interactable_parent_callback = "touch_the_thing"
|
interactable_parent_callback = "touch_the_thing"
|
||||||
|
|
||||||
[node name="PewMachine" parent="." index="13" instance=ExtResource( 28 )]
|
[node name="PewMachine" parent="." index="12" instance=ExtResource( 28 )]
|
||||||
|
|
||||||
[node name="Hitbox_Component" parent="." index="14" instance=ExtResource( 33 )]
|
[node name="Hitbox_Component" parent="." index="13" instance=ExtResource( 33 )]
|
||||||
collision_layer = 192
|
collision_layer = 192
|
||||||
damage_amount = 10
|
damage_amount = 10
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,4 @@ horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
jerk_factor = 0.0
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
|
||||||
vertical_acceleration = 0.0
|
|
||||||
vertical_speed_offset = 0.0
|
|
||||||
vertical_speed_offset_acceleration = 0.0
|
|
||||||
preserve_inertia = true
|
|
||||||
is_grounded = true
|
|
||||||
animation_sequence = [ "attack-punch" ]
|
animation_sequence = [ "attack-punch" ]
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,4 @@ horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
jerk_factor = 0.0
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
|
||||||
vertical_acceleration = 0.0
|
|
||||||
vertical_speed_offset = 0.0
|
|
||||||
vertical_speed_offset_acceleration = 0.0
|
|
||||||
preserve_inertia = true
|
|
||||||
is_grounded = true
|
|
||||||
animation_sequence = [ "attack-shoot" ]
|
animation_sequence = [ "attack-shoot" ]
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,4 @@ horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
jerk_factor = 0.0
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
|
||||||
vertical_acceleration = 0.0
|
|
||||||
vertical_speed_offset = 0.0
|
|
||||||
vertical_speed_offset_acceleration = 0.0
|
|
||||||
preserve_inertia = true
|
|
||||||
is_grounded = true
|
|
||||||
animation_sequence = [ "attack-sword" ]
|
animation_sequence = [ "attack-sword" ]
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,4 @@ horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
jerk_factor = 0.0
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
|
||||||
vertical_acceleration = 0.0
|
|
||||||
vertical_speed_offset = 0.0
|
|
||||||
vertical_speed_offset_acceleration = 0.0
|
|
||||||
preserve_inertia = true
|
|
||||||
is_grounded = true
|
|
||||||
animation_sequence = [ "climb" ]
|
animation_sequence = [ "climb" ]
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,4 @@ horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
jerk_factor = 0.0
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
|
||||||
vertical_acceleration = 0.0
|
|
||||||
vertical_speed_offset = 0.0
|
|
||||||
vertical_speed_offset_acceleration = 0.0
|
|
||||||
preserve_inertia = true
|
|
||||||
is_grounded = true
|
|
||||||
animation_sequence = [ "idle-crouch" ]
|
animation_sequence = [ "idle-crouch" ]
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,4 @@ horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
jerk_factor = 0.0
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
|
||||||
vertical_acceleration = 0.0
|
|
||||||
vertical_speed_offset = 0.0
|
|
||||||
vertical_speed_offset_acceleration = 0.0
|
|
||||||
preserve_inertia = true
|
|
||||||
is_grounded = true
|
|
||||||
animation_sequence = [ "run_crouch" ]
|
animation_sequence = [ "run_crouch" ]
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,4 @@ horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
jerk_factor = 0.0
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
|
||||||
vertical_acceleration = 0.0
|
|
||||||
vertical_speed_offset = 0.0
|
|
||||||
vertical_speed_offset_acceleration = 0.0
|
|
||||||
preserve_inertia = true
|
|
||||||
is_grounded = true
|
|
||||||
animation_sequence = [ "death" ]
|
animation_sequence = [ "death" ]
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,4 @@ horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
jerk_factor = 0.0
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
|
||||||
vertical_acceleration = 0.0
|
|
||||||
vertical_speed_offset = 0.0
|
|
||||||
vertical_speed_offset_acceleration = 0.0
|
|
||||||
preserve_inertia = true
|
|
||||||
is_grounded = true
|
|
||||||
animation_sequence = [ "walk" ]
|
animation_sequence = [ "walk" ]
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,4 @@ horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
jerk_factor = 0.0
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
|
||||||
vertical_acceleration = 0.0
|
|
||||||
vertical_speed_offset = 0.0
|
|
||||||
vertical_speed_offset_acceleration = 0.0
|
|
||||||
preserve_inertia = true
|
|
||||||
is_grounded = true
|
|
||||||
animation_sequence = [ "land" ]
|
animation_sequence = [ "land" ]
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,4 @@ horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
jerk_factor = 0.0
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
|
||||||
vertical_acceleration = 0.0
|
|
||||||
vertical_speed_offset = 0.0
|
|
||||||
vertical_speed_offset_acceleration = 0.0
|
|
||||||
preserve_inertia = true
|
|
||||||
is_grounded = true
|
|
||||||
animation_sequence = [ "ledge-climb" ]
|
animation_sequence = [ "ledge-climb" ]
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,4 @@ horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
jerk_factor = 0.0
|
jerk_factor = 0.0
|
||||||
vertical_speed = 0.0
|
|
||||||
vertical_acceleration = 0.0
|
|
||||||
vertical_speed_offset = 0.0
|
|
||||||
vertical_speed_offset_acceleration = 0.0
|
|
||||||
preserve_inertia = true
|
|
||||||
is_grounded = true
|
|
||||||
animation_sequence = [ "ledge-grab" ]
|
animation_sequence = [ "ledge-grab" ]
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,6 @@ puppet var puppet_direction_normal :Vector2
|
||||||
puppet var puppet_position
|
puppet var puppet_position
|
||||||
|
|
||||||
var time_alive :float = 0.0
|
var time_alive :float = 0.0
|
||||||
|
|
||||||
var velocity_controller :VelocityController = VelocityController.new()
|
|
||||||
|
|
||||||
var movement_parameters :MovementParameters
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
puppet_direction_normal = direction_normal
|
puppet_direction_normal = direction_normal
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
class_name VelocityController
|
class_name VelocityCalculations
|
||||||
|
|
||||||
var velocity :Vector2
|
var velocity :Vector2
|
||||||
var debug :bool = false
|
var debug :bool = false
|
||||||
|
|
@ -90,12 +90,10 @@ func calculate_velocity(_delta :float,
|
||||||
# may also want to reset when hspeed is static
|
# may also want to reset when hspeed is static
|
||||||
if (h_range_placement == RANGE_PLACEMENT.WITHIN_RANGE and
|
if (h_range_placement == RANGE_PLACEMENT.WITHIN_RANGE and
|
||||||
_h_impulse_applied == true ):
|
_h_impulse_applied == true ):
|
||||||
if debug:
|
|
||||||
print("resetting H impulse")
|
print("resetting H impulse")
|
||||||
_h_impulse_applied = false
|
_h_impulse_applied = false
|
||||||
if (v_range_placement == RANGE_PLACEMENT.WITHIN_RANGE and
|
if (v_range_placement == RANGE_PLACEMENT.WITHIN_RANGE and
|
||||||
_v_impulse_applied == true ):
|
_v_impulse_applied == true ):
|
||||||
if debug:
|
|
||||||
print("resetting V impulse")
|
print("resetting V impulse")
|
||||||
_v_impulse_applied = false
|
_v_impulse_applied = false
|
||||||
|
|
||||||
|
|
@ -103,8 +101,6 @@ func calculate_velocity(_delta :float,
|
||||||
# move toward functions.
|
# move toward functions.
|
||||||
calc_acceleration.x = abs(resolve_h_acceleration(movement_parameters, move_direction.x))
|
calc_acceleration.x = abs(resolve_h_acceleration(movement_parameters, move_direction.x))
|
||||||
|
|
||||||
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
|
## We are always moving from h_speed.x towards y at a given rate
|
||||||
## if we have a difference of speed and an acceleration
|
## if we have a difference of speed and an acceleration
|
||||||
##TODO: The Min Max could be augmented to just be h_speed.x and prevent the sliding.
|
##TODO: The Min Max could be augmented to just be h_speed.x and prevent the sliding.
|
||||||
|
|
@ -132,9 +128,6 @@ func calculate_velocity(_delta :float,
|
||||||
min(h_speed.x, h_speed.y),
|
min(h_speed.x, h_speed.y),
|
||||||
max(h_speed.x, h_speed.y))
|
max(h_speed.x, h_speed.y))
|
||||||
RANGE_PLACEMENT.PAST_RANGE:
|
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
|
calc_inertia.x = clamp(calc_inertia.x - direction_accel, # Friction
|
||||||
min(calc_inertia.x, h_speed.y),
|
min(calc_inertia.x, h_speed.y),
|
||||||
max(calc_inertia.x, h_speed.y))
|
max(calc_inertia.x, h_speed.y))
|
||||||
|
|
@ -1,25 +1,20 @@
|
||||||
[gd_scene load_steps=11 format=2]
|
[gd_scene load_steps=7 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/templates/level_templates/LevelTemplate.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://src/templates/level_templates/LevelTemplate.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://assets/levels/LegacyFantasy-High_Forest/tileset.tres" type="TileSet" id=2]
|
[ext_resource path="res://assets/levels/LegacyFantasy-High_Forest/tileset.tres" type="TileSet" id=2]
|
||||||
[ext_resource path="res://lib/components/Hitbox_Component.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://lib/components/Hitbox_Component.tscn" type="PackedScene" id=3]
|
||||||
[ext_resource path="res://src/Interactables/LevelTransition.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://src/Interactables/LevelTransition.tscn" type="PackedScene" id=4]
|
||||||
[ext_resource path="res://src/Interactables/modifiers/icy_surface.tres" type="Resource" id=5]
|
|
||||||
[ext_resource path="res://lib/components/Modifier_Component.tscn" type="PackedScene" id=6]
|
|
||||||
[ext_resource path="res://assets/Fonts/default_font.tres" type="Theme" id=7]
|
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id=1]
|
[sub_resource type="CircleShape2D" id=1]
|
||||||
radius = 5.09902
|
radius = 5.09902
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=2]
|
[sub_resource type="RectangleShape2D" id=2]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id=3]
|
|
||||||
|
|
||||||
[node name="CloneBox" groups=["world"] instance=ExtResource( 1 )]
|
[node name="CloneBox" groups=["world"] instance=ExtResource( 1 )]
|
||||||
|
|
||||||
[node name="TileMap Collision" parent="." index="1"]
|
[node name="TileMap Collision" parent="." index="1"]
|
||||||
tile_set = ExtResource( 2 )
|
tile_set = ExtResource( 2 )
|
||||||
tile_data = PoolIntArray( -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( -196609, 4, 0, -131073, 4, 0, -65537, 4, 0, -3, 4, 0, -2, 4, 0, -1, 4, 0, -65517, 4, 0, 65533, 4, 0, 19, 4, 65536, 131069, 4, 0, 65555, 4, 65536, 196605, 4, 0, 131073, 2, 1, 131074, 2, 2, 131091, 4, 65536, 262141, 4, 0, 262142, 4, 0, 262143, 4, 0, 196608, 4, 65536, 196609, 2, 65537, 196610, 2, 65538, 196627, 4, 65536, 262144, 4, 0, 262163, 4, 0, 327680, 4, 65536, 327699, 4, 65536, 393216, 4, 65536, 393235, 4, 65536, 458752, 4, 65536, 458771, 4, 65536, 589823, 0, 1, 524288, 4, 131072, 524289, 0, 3, 524290, 0, 1, 524291, 0, 2, 524292, 0, 3, 524293, 0, 1, 524294, 0, 2, 524295, 0, 3, 524296, 0, 1, 524297, 0, 2, 524298, 0, 3, 524299, 0, 1, 524300, 0, 2, 524301, 0, 3, 524302, 0, 1, 524303, 0, 2, 524304, 0, 3, 524305, 0, 1, 524306, 0, 2, 524307, 4, 0, 524308, 0, 1, 524309, 0, 2, 524310, 0, 3, 655359, 0, 65537, 589824, 0, 65538, 589825, 0, 65539, 589826, 0, 65537, 589827, 0, 65538, 589828, 0, 65539, 589829, 0, 65537, 589830, 0, 65538, 589831, 0, 65539, 589832, 0, 65537, 589833, 0, 65538, 589834, 0, 65539, 589835, 0, 65537, 589836, 0, 65538, 589837, 0, 65539, 589838, 0, 65537, 589839, 0, 65538, 589840, 0, 65539, 589841, 0, 65537, 589842, 0, 65538, 589843, 0, 65539, 589844, 0, 65537, 589845, 0, 65538, 589846, 0, 65539, 720895, 0, 131073, 655360, 0, 131074, 655361, 0, 131075, 655362, 0, 131073, 655363, 0, 131074, 655364, 0, 131075, 655365, 0, 131073, 655366, 0, 131074, 655367, 0, 131075, 655368, 0, 131073, 655369, 0, 131074, 655370, 0, 131075, 655371, 0, 131073, 655372, 0, 131074, 655373, 0, 131075, 655374, 0, 131073, 655375, 0, 131074, 655376, 0, 131075, 655377, 0, 131073, 655378, 0, 131074, 655379, 0, 131075, 655380, 0, 131073, 655381, 0, 131074, 655382, 0, 131075, 786431, 0, 196609, 720896, 0, 196610, 720897, 0, 196611, 720898, 0, 196609, 720899, 0, 196610, 720900, 0, 196611, 720901, 0, 196609, 720902, 0, 196610, 720903, 0, 196611, 720904, 0, 196609, 720905, 0, 196610, 720906, 0, 196611, 720907, 0, 196609, 720908, 0, 196610, 720909, 0, 196611, 720910, 0, 196609, 720911, 0, 196610, 720912, 0, 196611, 720913, 0, 196609, 720914, 0, 196610, 720915, 0, 196611, 720916, 0, 196609, 720917, 0, 196610, 720918, 0, 196611, 851967, 0, 262145, 786432, 0, 262146, 786433, 0, 262147, 786434, 0, 262145, 786435, 0, 262146, 786436, 0, 262147, 786437, 0, 262145, 786438, 0, 262146, 786439, 0, 262147, 786440, 0, 262145, 786441, 0, 262146, 786442, 0, 262147, 786443, 0, 262145, 786444, 0, 262146, 786445, 0, 262147, 786446, 0, 262145, 786447, 0, 262146, 786448, 0, 262147, 786449, 0, 262145, 786450, 0, 262146, 786451, 0, 262147, 786452, 0, 262145, 786453, 0, 262146, 786454, 0, 262147 )
|
||||||
|
|
||||||
[node name="TileMap Foreground" parent="." index="2"]
|
[node name="TileMap Foreground" parent="." index="2"]
|
||||||
tile_set = ExtResource( 2 )
|
tile_set = ExtResource( 2 )
|
||||||
|
|
@ -60,23 +55,3 @@ shape = SubResource( 2 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_lock_": true
|
"_edit_lock_": true
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Camera Bounds" parent="." index="7"]
|
|
||||||
tile_data = PoolIntArray( -65536, 0, 0, -65521, 0, 0, 65535, 0, 0, 16, 0, 0, 524287, 0, 0, 458768, 0, 0, 589824, 0, 0, 589839, 0, 0 )
|
|
||||||
|
|
||||||
[node name="Modifier_Component" parent="." index="8" instance=ExtResource( 6 )]
|
|
||||||
position = Vector2( 248, 115 )
|
|
||||||
modifier = ExtResource( 5 )
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Modifier_Component" index="0"]
|
|
||||||
shape = SubResource( 3 )
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="." index="9"]
|
|
||||||
margin_left = 78.0
|
|
||||||
margin_top = 9.0
|
|
||||||
margin_right = 244.0
|
|
||||||
margin_bottom = 25.0
|
|
||||||
theme = ExtResource( 7 )
|
|
||||||
text = "The floor is slippy"
|
|
||||||
align = 1
|
|
||||||
valign = 1
|
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,6 @@
|
||||||
[gd_scene load_steps=5 format=2]
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/classes/Level.gd" type="Script" id=1]
|
[ext_resource path="res://src/classes/Level.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://assets/UI/no_cam_tile.png" type="Texture" id=2]
|
|
||||||
|
|
||||||
[sub_resource type="ConvexPolygonShape2D" id=5]
|
|
||||||
points = PoolVector2Array( 20, 20, 0.326027, 20, 0.326027, 0.605103, 20, 0.605103 )
|
|
||||||
|
|
||||||
[sub_resource type="TileSet" id=6]
|
|
||||||
0/name = "no_cam_tile.png 0"
|
|
||||||
0/texture = ExtResource( 2 )
|
|
||||||
0/tex_offset = Vector2( 0, 0 )
|
|
||||||
0/modulate = Color( 1, 1, 1, 1 )
|
|
||||||
0/region = Rect2( 0, 0, 20, 20 )
|
|
||||||
0/tile_mode = 0
|
|
||||||
0/occluder_offset = Vector2( 0, 0 )
|
|
||||||
0/navigation_offset = Vector2( 0, 0 )
|
|
||||||
0/shape_offset = Vector2( 0, 0 )
|
|
||||||
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
|
||||||
0/shape = SubResource( 5 )
|
|
||||||
0/shape_one_way = false
|
|
||||||
0/shape_one_way_margin = 1.0
|
|
||||||
0/shapes = [ {
|
|
||||||
"autotile_coord": Vector2( 0, 0 ),
|
|
||||||
"one_way": false,
|
|
||||||
"one_way_margin": 1.0,
|
|
||||||
"shape": SubResource( 5 ),
|
|
||||||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
|
|
||||||
} ]
|
|
||||||
0/z_index = 0
|
|
||||||
|
|
||||||
[node name="LevelTemplate" type="Node2D"]
|
[node name="LevelTemplate" type="Node2D"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
@ -48,11 +21,3 @@ cell_size = Vector2( 16, 16 )
|
||||||
format = 1
|
format = 1
|
||||||
|
|
||||||
[node name="PlayerStart" type="Position2D" parent="."]
|
[node name="PlayerStart" type="Position2D" parent="."]
|
||||||
|
|
||||||
[node name="Camera Bounds" type="TileMap" parent="."]
|
|
||||||
tile_set = SubResource( 6 )
|
|
||||||
cell_size = Vector2( 20, 20 )
|
|
||||||
show_collision = true
|
|
||||||
collision_layer = 256
|
|
||||||
collision_mask = 0
|
|
||||||
format = 1
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user