diff --git a/Core/Scripts/smoother.gd b/Core/Scripts/smoother.gd new file mode 100644 index 0000000..b1b2fd5 --- /dev/null +++ b/Core/Scripts/smoother.gd @@ -0,0 +1,229 @@ +# MIT LICENSE +# +# Copyright 2022 Anatol Bogun +# +# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +# associated documentation files (the "Software"), to deal in the Software without restriction, +# including without limitation the rights to use, copy, modify, merge, publish, distribute, +# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all copies or +# substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +# NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +class_name Smoother extends Node + +## Smoother Node +## Version: 1.0.4 +## +## A node type that smoothes scene nodes' properties by interpolating _physics_process steps. +## +## For documentation please visit https://github.com/anatolbogun/godot-smoother-node . + +## Node properties that are interpolated. +## Defaults to ["position"], even if not displayed in the inspector. +@export var properties:Array[String] = ["position"] + +## Apply interpolation to this node's parent. +@export var smooth_parent: = true : + set (value): + if value == false: + # remove parent from _properties in case this gets toggled on and off during runtime + _properties.erase(get_parent()) + + smooth_parent = value + +## Apply interpolation to the recursive children of this node's parent. +@export var recursive: = true + +## Explicitly include node paths in addition to the nodes that are included by other Smoother +## settings. +@export var includes:Array[NodePath] = [] + +## Explicitly exclude node paths. +## This will exclude nodes that would otherwise be included by other settings. +@export var excludes:Array[NodePath] = [] + +# get an array of all currently smoothed nodes; mainly for debugging performance optimisations +var smoothed_nodes:Array[Node] : + get: + var parent: = get_parent() + return _get_physics_process_nodes(parent, !smooth_parent) if parent != null else [] as Array[Node] + +var _properties: = {} +var _physics_process_nodes:Array[Node] +var _physics_process_just_updated: = false + + +## Reset all smoothed nodes. +func reset() -> void: + _properties.clear() + + +## Reset a specific node. You may want to call this when a node gets teleported. +func reset_node(node:Node) -> void: + _properties.erase(node) + + +## Reset a specific Node by NodePath. You may want to call this when a Node gets teleported. +func reset_node_path(path:NodePath) -> void: + var node: = get_node_or_null(path) + + if node != null: + reset_node(node) + + +## Add a Node to the includes Array[NodePath]. +func add_include_node(node:Node) -> Array[NodePath]: + return add_include_path(get_path_to(node)) + + +## Add a NodePath to the includes Array[NodePath]. +func add_include_path(path:NodePath) -> Array[NodePath]: + return _add_unique_to_array(includes, path) as Array[NodePath] + + +## Remove a Node from the includes Array[NodePath]. +func remove_include_node(node:Node) -> Array[NodePath]: + return remove_include_path(get_path_to(node)) + + +## Remove a NodePath from the includes Array[NodePath]. +func remove_include_path(path:NodePath) -> Array[NodePath]: + return _remove_all_from_array(includes, path) as Array[NodePath] + + +## Add a Node to the excludes Array[NodePath]. +func add_exclude_node(node:Node) -> Array[NodePath]: + return add_exclude_path(get_path_to(node)) + + +## Add a NodePath to the excludes Array[NodePath]. +func add_exclude_path(path:NodePath) -> Array[NodePath]: + return _add_unique_to_array(excludes, path) as Array[NodePath] + + +## Remove a Node from the excludes Array[NodePath]. +func remove_exclude_node(node:Node) -> Array[NodePath]: + return remove_exclude_path(get_path_to(node)) + + +## Remove a NodePath from the excludes Array[NodePath]. +func remove_exclude_path(path:NodePath) -> Array[NodePath]: + return _remove_all_from_array(excludes, path) as Array[NodePath] + + +## Add an item to an array unless the array already contains that item. +func _add_unique_to_array(array:Array, item:Variant) -> Array: + if !array.has(item): + array.push_back(item) + + return array + + +## Remove all array items that match item. +func _remove_all_from_array(array:Array, item:Variant) -> Array: + while array.has(item): + array.erase(item) + + return array + + +## Apply interpolation to all smoothed_nodes supported properties. +func _process(_delta: float) -> void: + for node in _physics_process_nodes: + if !_properties.has(node): continue + + for property in _properties[node]: + var values = _properties[node][property] + + if values.size() == 2: + if _physics_process_just_updated: + values[1] = node[property] + + node[property] = lerp(values[0], values[1], Engine.get_physics_interpolation_fraction()) + + _physics_process_just_updated = false + + +## Store all smoothed_nodes' relevant properties of the previous (origin) and this (target) +## _physics_process frames for interpolation in the upcoming _process frames and apply the origin +## values. +func _physics_process(_delta: float) -> void: + var parent: = get_parent() + if parent == null: return + + # move this node to the top of the parent tree (typically a scene's root node) so that it is + # called before all other _physics_processes + parent.move_child(self, 0) + + if smooth_parent: + process_priority = parent.process_priority - 1 + + # update the relevant nodes once per _physics_process + _physics_process_nodes = _get_physics_process_nodes(parent, !smooth_parent) + + # clean up _properties + for key in _properties.keys(): + if !_physics_process_nodes.has(key): + _properties.erase(key) + + for node in _physics_process_nodes: + if !_properties.has(node): + # called on the first frame after a node was added to _properties + _properties[node] = {} + + # clean up _properties when a node exited the tree + node.tree_exited.connect(func (): _properties.erase(node)) + + for property in properties: + if ! property in node: continue + + if !_properties[node].has(property): + # called on the first frame after a node was added to _properties + _properties[node][property] = [node[property]] + elif _properties[node][property].size() < 2: + # called on the second frame after a node was added to _properties + _properties[node][property].push_front(_properties[node][property][0]) + _properties[node][property][1] = node[property] + else: + _properties[node][property][0] = _properties[node][property][1] + node[property] = _properties[node][property][0] + + _physics_process_just_updated = true + + +## Get the relevant nodes to be smoothed based on this node's tree position and properties. +func _get_physics_process_nodes(node: Node, ignore_node: = false, with_includes: = true) -> Array[Node]: + var nodes:Array[Node] = [] + + nodes.assign(includes.map( + get_node_or_null + ).filter( + func (_node:Node) -> bool: return _node != null && !excludes.has(get_path_to(_node)) + ) if with_includes else []) + + if ( + !ignore_node + && node != self + && !node is RigidBody2D + && !node is RigidBody3D + && !nodes.has(node) + && !excludes.has(get_path_to(node)) + && node.has_method("_physics_process") + ): + nodes.push_back(node) + + if recursive: + for child in node.get_children(): + for nested_node in _get_physics_process_nodes(child, false, false): + _add_unique_to_array(nodes, nested_node) + + return nodes diff --git a/Maps/Testing Purgatory.tscn b/Maps/Testing Purgatory.tscn index d3bce56..d8796f0 100644 --- a/Maps/Testing Purgatory.tscn +++ b/Maps/Testing Purgatory.tscn @@ -1,7 +1,9 @@ -[gd_scene load_steps=5 format=3 uid="uid://cw55umm21amea"] +[gd_scene load_steps=7 format=3 uid="uid://cw55umm21amea"] [ext_resource type="Texture2D" uid="uid://dmlk63esqvmiv" path="res://Tilemaps/BasicSquare/Texture.png" id="1_8s7p6"] [ext_resource type="PackedScene" uid="uid://cqcjan67wgkc1" path="res://Player/BasicCharacter/Character.tscn" id="1_jcngi"] +[ext_resource type="Script" path="res://Core/Scripts/smoother.gd" id="3_16g5e"] +[ext_resource type="PackedScene" uid="uid://b6rvghqqnqqk1" path="res://Player/GUI/GUI.tscn" id="4_7j33c"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_t1l2y"] texture = ExtResource("1_8s7p6") @@ -23,7 +25,8 @@ texture_region_size = Vector2i(32, 32) [sub_resource type="TileSet" id="TileSet_qp0ib"] tile_size = Vector2i(32, 32) -physics_layer_0/collision_layer = 1 +physics_layer_0/collision_layer = 5 +physics_layer_0/collision_mask = 5 terrain_set_0/mode = 0 terrain_set_0/terrain_0/name = "Terrain 0" terrain_set_0/terrain_0/color = Color(0.5, 0.34375, 0.25, 1) @@ -36,9 +39,10 @@ metadata/_edit_horizontal_guides_ = [15.0] [node name="TileMap" type="TileMap" parent="Map"] modulate = Color(0, 0, 0.486275, 1) +scale = Vector2(1.00629, 1.00935) tile_set = SubResource("TileSet_qp0ib") format = 2 -layer_0/tile_data = PackedInt32Array(589824, 0, 0, 589825, 0, 0, 589826, 0, 0, 589827, 0, 0, 589828, 0, 0, 589829, 0, 0, 589830, 0, 0, 589831, 0, 0, 589832, 0, 0, 589833, 0, 0, 589834, 0, 0, 589835, 0, 0, 589836, 0, 0, 589837, 0, 0, 589838, 0, 0, 589839, 0, 0, 589840, 0, 0, 589841, 0, 0, 655359, 0, 0, 655358, 0, 0, 655357, 0, 0, 655356, 0, 0, 655355, 0, 0, 655354, 0, 0, 655353, 0, 0, 655352, 0, 0, 655351, 0, 0, 589815, 0, 0, 589816, 0, 0, 589817, 0, 0, 589818, 0, 0, 589819, 0, 0, 589820, 0, 0, 589821, 0, 0, 589822, 0, 0, 589823, 0, 0, 524288, 0, 0, 524289, 0, 0, 524299, 0, 0, 524292, 0, 0, 524291, 0, 0, 524290, 0, 0, 524298, 0, 0, 524297, 0, 0, 524296, 0, 0, 524295, 0, 0, 524293, 0, 0, 524294, 0, 0, 524300, 0, 0, 524301, 0, 0, 524302, 0, 0, 524303, 0, 0, 524304, 0, 0, 524305, 0, 0, 524306, 0, 0, 589842, 0, 0, 655350, 0, 0, 589814, 0, 0, 524278, 0, 0, 458742, 0, 0, 393206, 0, 0, 327670, 0, 0, 262134, 0, 0, 196598, 0, 0, 131062, 0, 0, 65526, 0, 0, -10, 0, 0, -65546, 0, 0, -131082, 0, 0, -196618, 0, 0, -262154, 0, 0, 655349, 0, 0, 589813, 0, 0, 524277, 0, 0, 458741, 0, 0, 393205, 0, 0, 327669, 0, 0, 262133, 0, 0, 196597, 0, 0, 131061, 0, 0, 65525, 0, 0, -11, 0, 0, -65547, 0, 0, -131083, 0, 0, -196619, 0, 0, -262155, 0, 0, 655348, 0, 0, 589812, 0, 0, 655347, 0, 0, 589811, 0, 0, 655346, 0, 0, 589810, 0, 0, 655345, 0, 0, 589809, 0, 0, 655344, 0, 0, 589808, 0, 0, 655343, 0, 0, 589807, 0, 0, 655342, 0, 0, 589806, 0, 0, 655341, 0, 0, 589805, 0, 0, 655340, 0, 0, 589804, 0, 0, 655339, 0, 0, 589803, 0, 0, 655338, 0, 0, 589802, 0, 0, 458764, 0, 0, 393228, 0, 0, 327692, 0, 0, 262156, 0, 0, 196620, 0, 0, 131084, 0, 0, 65548, 0, 0, 12, 0, 0, 458763, 0, 0, 393227, 0, 0, 327691, 0, 0, 262155, 0, 0, 196619, 0, 0, 131083, 0, 0, 65547, 0, 0, 11, 0, 0, 589852, 0, 0, 524316, 0, 0, 589851, 0, 0, 524315, 0, 0, 589850, 0, 0, 524314, 0, 0, 589849, 0, 0, 524313, 0, 0, 589848, 0, 0, 524312, 0, 0, 589847, 0, 0, 524311, 0, 0, 589846, 0, 0, 524310, 0, 0, 589845, 0, 0, 524309, 0, 0, 589844, 0, 0, 524308, 0, 0, 589843, 0, 0, 524307, 0, 0) +layer_0/tile_data = PackedInt32Array(589824, 0, 0, 589825, 0, 0, 589826, 0, 0, 589827, 0, 0, 589828, 0, 0, 589829, 0, 0, 589830, 0, 0, 589831, 0, 0, 589832, 0, 0, 589833, 0, 0, 589834, 0, 0, 589835, 0, 0, 589836, 0, 0, 589837, 0, 0, 589838, 0, 0, 589839, 0, 0, 589840, 0, 0, 589841, 0, 0, 655359, 0, 0, 655358, 0, 0, 655357, 0, 0, 655356, 0, 0, 655355, 0, 0, 655354, 0, 0, 655353, 0, 0, 655352, 0, 0, 655351, 0, 0, 589815, 0, 0, 589816, 0, 0, 589817, 0, 0, 589818, 0, 0, 589819, 0, 0, 589820, 0, 0, 589821, 0, 0, 589822, 0, 0, 589823, 0, 0, 524288, 0, 0, 524289, 0, 0, 524299, 0, 0, 524292, 0, 0, 524291, 0, 0, 524290, 0, 0, 524298, 0, 0, 524297, 0, 0, 524296, 0, 0, 524295, 0, 0, 524293, 0, 0, 524294, 0, 0, 524300, 0, 0, 524301, 0, 0, 524302, 0, 0, 524303, 0, 0, 524304, 0, 0, 524305, 0, 0, 524306, 0, 0, 589842, 0, 0, 655350, 0, 0, 589814, 0, 0, 524278, 0, 0, 458742, 0, 0, 393206, 0, 0, 327670, 0, 0, 262134, 0, 0, 196598, 0, 0, 131062, 0, 0, 65526, 0, 0, -10, 0, 0, -65546, 0, 0, -131082, 0, 0, -196618, 0, 0, -262154, 0, 0, 655349, 0, 0, 589813, 0, 0, 524277, 0, 0, 458741, 0, 0, 393205, 0, 0, 327669, 0, 0, 262133, 0, 0, 196597, 0, 0, 131061, 0, 0, 65525, 0, 0, -11, 0, 0, -65547, 0, 0, -131083, 0, 0, -196619, 0, 0, -262155, 0, 0, 655348, 0, 0, 589812, 0, 0, 655347, 0, 0, 589811, 0, 0, 655346, 0, 0, 589810, 0, 0, 655345, 0, 0, 589809, 0, 0, 655344, 0, 0, 589808, 0, 0, 655343, 0, 0, 589807, 0, 0, 655342, 0, 0, 589806, 0, 0, 655341, 0, 0, 589805, 0, 0, 655340, 0, 0, 589804, 0, 0, 655339, 0, 0, 589803, 0, 0, 655338, 0, 0, 589802, 0, 0, 458764, 0, 0, 393228, 0, 0, 327692, 0, 0, 262156, 0, 0, 196620, 0, 0, 131084, 0, 0, 65548, 0, 0, 12, 0, 0, 458763, 0, 0, 393227, 0, 0, 327691, 0, 0, 262155, 0, 0, 196619, 0, 0, 131083, 0, 0, 65547, 0, 0, 11, 0, 0, 589852, 0, 0, 524316, 0, 0, 589851, 0, 0, 524315, 0, 0, 589850, 0, 0, 524314, 0, 0, 589849, 0, 0, 524313, 0, 0, 589848, 0, 0, 524312, 0, 0, 589847, 0, 0, 524311, 0, 0, 589846, 0, 0, 524310, 0, 0, 589845, 0, 0, 524309, 0, 0, 589844, 0, 0, 524308, 0, 0, 589843, 0, 0, 524307, 0, 0, 655337, 0, 0, 589801, 0, 0, 655336, 0, 0, 589800, 0, 0, 655335, 0, 0, 589799, 0, 0, 655334, 0, 0, 589798, 0, 0, 655333, 0, 0, 589797, 0, 0, 655332, 0, 0, 589796, 0, 0, 655331, 0, 0, 589795, 0, 0, 655330, 0, 0, 589794, 0, 0, 655329, 0, 0, 589793, 0, 0, 655328, 0, 0, 589792, 0, 0, 655327, 0, 0, 589791, 0, 0, 655326, 0, 0, 589790, 0, 0, 655325, 0, 0, 589789, 0, 0, 655324, 0, 0, 589788, 0, 0, 655323, 0, 0, 589787, 0, 0, 655322, 0, 0, 589786, 0, 0, 655321, 0, 0, 589785, 0, 0, 655320, 0, 0, 589784, 0, 0, 655319, 0, 0, 589783, 0, 0, 655318, 0, 0, 589782, 0, 0, 655317, 0, 0, 589781, 0, 0, 655316, 0, 0, 589780, 0, 0, 655315, 0, 0, 589779, 0, 0, 655314, 0, 0, 589778, 0, 0, 655313, 0, 0, 589777, 0, 0, 655312, 0, 0, 589776, 0, 0, 655311, 0, 0, 589775, 0, 0, 655310, 0, 0, 589774, 0, 0, 655309, 0, 0, 589773, 0, 0, 655308, 0, 0, 589772, 0, 0, 655307, 0, 0, 589771, 0, 0, 655306, 0, 0, 589770, 0, 0, 655305, 0, 0, 589769, 0, 0, 655304, 0, 0, 589768, 0, 0, 655303, 0, 0, 589767, 0, 0, 655302, 0, 0, 589766, 0, 0, 655301, 0, 0, 589765, 0, 0, 655300, 0, 0, 589764, 0, 0, 655299, 0, 0, 589763, 0, 0, 655298, 0, 0, 589762, 0, 0, 655297, 0, 0, 589761, 0, 0, 655296, 0, 0, 589760, 0, 0, 655295, 0, 0, 589759, 0, 0, 655294, 0, 0, 589758, 0, 0, 655293, 0, 0, 589757, 0, 0, 655292, 0, 0, 589756, 0, 0, 655291, 0, 0, 589755, 0, 0, 655290, 0, 0, 589754, 0, 0, 655289, 0, 0, 589753, 0, 0, 655288, 0, 0, 589752, 0, 0, 655287, 0, 0, 589751, 0, 0, 655286, 0, 0, 589750, 0, 0, 655285, 0, 0, 589749, 0, 0, 655284, 0, 0, 589748, 0, 0, 655283, 0, 0, 589747, 0, 0, 655282, 0, 0, 589746, 0, 0, 655281, 0, 0, 589745, 0, 0, 655280, 0, 0, 589744, 0, 0, 655279, 0, 0, 589743, 0, 0, 655278, 0, 0, 589742, 0, 0, 655277, 0, 0, 589741, 0, 0, 655276, 0, 0, 589740, 0, 0, 655275, 0, 0, 589739, 0, 0, 655274, 0, 0, 589738, 0, 0, 655273, 0, 0, 589737, 0, 0, 655272, 0, 0, 589736, 0, 0, 655271, 0, 0, 589735, 0, 0, 655270, 0, 0, 589734, 0, 0, 655269, 0, 0, 589733, 0, 0, 655268, 0, 0, 589732, 0, 0, 655267, 0, 0, 589731, 0, 0, 655266, 0, 0, 589730, 0, 0, 655265, 0, 0, 589729, 0, 0, 655264, 0, 0, 589728, 0, 0, 655263, 0, 0, 589727, 0, 0, 655262, 0, 0, 589726, 0, 0, 655261, 0, 0, 589725, 0, 0, 655260, 0, 0, 589724, 0, 0, 655259, 0, 0, 589723, 0, 0, 655258, 0, 0, 589722, 0, 0, 655257, 0, 0, 589721, 0, 0, 655256, 0, 0, 589720, 0, 0, 655255, 0, 0, 589719, 0, 0, 655254, 0, 0, 589718, 0, 0, 655253, 0, 0, 589717, 0, 0, 655252, 0, 0, 589716, 0, 0, 655251, 0, 0, 589715, 0, 0, 655250, 0, 0, 589714, 0, 0, 655249, 0, 0, 589713, 0, 0, 655248, 0, 0, 589712, 0, 0, 655247, 0, 0, 589711, 0, 0, 655246, 0, 0, 589710, 0, 0, 655245, 0, 0, 589709, 0, 0, 655244, 0, 0, 589708, 0, 0, 655243, 0, 0, 589707, 0, 0, 655242, 0, 0, 589706, 0, 0, 655241, 0, 0, 589705, 0, 0, 655240, 0, 0, 589704, 0, 0, 655239, 0, 0, 589703, 0, 0, 655238, 0, 0, 589702, 0, 0, 655237, 0, 0, 589701, 0, 0, 655236, 0, 0, 589700, 0, 0, 655235, 0, 0, 589699, 0, 0, 655234, 0, 0, 589698, 0, 0, 655233, 0, 0, 589697, 0, 0, 655232, 0, 0, 589696, 0, 0, 655231, 0, 0, 589695, 0, 0, 655230, 0, 0, 589694, 0, 0, 655229, 0, 0, 589693, 0, 0, 655228, 0, 0, 589692, 0, 0, 655227, 0, 0, 589691, 0, 0, 655226, 0, 0, 589690, 0, 0, 655225, 0, 0, 589689, 0, 0, 655224, 0, 0, 589688, 0, 0, 655223, 0, 0, 589687, 0, 0, 655222, 0, 0, 589686, 0, 0, 655221, 0, 0, 589685, 0, 0, 655220, 0, 0, 589684, 0, 0, 655219, 0, 0, 589683, 0, 0, 655218, 0, 0, 589682, 0, 0, 655217, 0, 0, 589681, 0, 0, 655216, 0, 0, 589680, 0, 0, 655215, 0, 0, 589679, 0, 0, 655214, 0, 0, 589678, 0, 0, 655213, 0, 0, 589677, 0, 0, 655212, 0, 0, 589676, 0, 0, 655211, 0, 0, 589675, 0, 0, 655210, 0, 0, 589674, 0, 0, 655209, 0, 0, 589673, 0, 0, 655208, 0, 0, 589672, 0, 0, 655207, 0, 0, 589671, 0, 0, 655206, 0, 0, 589670, 0, 0, 655205, 0, 0, 589669, 0, 0, 655204, 0, 0, 589668, 0, 0, 655203, 0, 0, 589667, 0, 0, 655202, 0, 0, 589666, 0, 0, 655201, 0, 0, 589665, 0, 0, 655200, 0, 0, 589664, 0, 0, 655199, 0, 0, 589663, 0, 0, 655198, 0, 0, 589662, 0, 0, 655197, 0, 0, 589661, 0, 0, 655196, 0, 0, 589660, 0, 0, 655195, 0, 0, 589659, 0, 0, 655194, 0, 0, 589658, 0, 0, 655193, 0, 0, 589657, 0, 0, 655192, 0, 0, 589656, 0, 0, 655191, 0, 0, 589655, 0, 0, 655190, 0, 0, 589654, 0, 0, 655189, 0, 0, 589653, 0, 0, 655188, 0, 0, 589652, 0, 0, 655187, 0, 0, 589651, 0, 0, 655186, 0, 0, 589650, 0, 0, 655185, 0, 0, 589649, 0, 0, 655184, 0, 0, 589648, 0, 0, 655183, 0, 0, 589647, 0, 0, 655182, 0, 0, 589646, 0, 0, 655181, 0, 0, 589645, 0, 0, 655180, 0, 0, 589644, 0, 0, 655179, 0, 0, 589643, 0, 0, 655178, 0, 0, 589642, 0, 0, 655177, 0, 0, 589641, 0, 0, 655176, 0, 0, 589640, 0, 0, 655175, 0, 0, 589639, 0, 0, 655174, 0, 0, 589638, 0, 0, 655173, 0, 0, 589637, 0, 0, 655172, 0, 0, 589636, 0, 0, 655171, 0, 0, 589635, 0, 0, 655170, 0, 0, 589634, 0, 0, 655169, 0, 0, 589633, 0, 0, 655168, 0, 0, 589632, 0, 0, 655167, 0, 0, 589631, 0, 0, 655166, 0, 0, 589630, 0, 0, 655165, 0, 0, 589629, 0, 0, 655164, 0, 0, 589628, 0, 0, 655163, 0, 0, 589627, 0, 0, 655162, 0, 0, 589626, 0, 0, 655161, 0, 0, 589625, 0, 0, 655160, 0, 0, 589624, 0, 0, 655159, 0, 0, 589623, 0, 0, 655158, 0, 0, 589622, 0, 0, 655157, 0, 0, 589621, 0, 0, 655156, 0, 0, 589620, 0, 0, 655155, 0, 0, 589619, 0, 0, 655154, 0, 0, 589618, 0, 0, 655153, 0, 0, 589617, 0, 0, 655152, 0, 0, 589616, 0, 0, 655151, 0, 0, 589615, 0, 0, 655150, 0, 0, 589614, 0, 0, 655149, 0, 0, 589613, 0, 0, 655148, 0, 0, 589612, 0, 0, 655147, 0, 0, 589611, 0, 0, 655146, 0, 0, 589610, 0, 0, 655145, 0, 0, 589609, 0, 0, 655144, 0, 0, 589608, 0, 0, 655143, 0, 0, 589607, 0, 0, 655142, 0, 0, 589606, 0, 0, 655141, 0, 0, 589605, 0, 0, 655140, 0, 0, 589604, 0, 0, 655139, 0, 0, 589603, 0, 0, 655138, 0, 0, 589602, 0, 0, 655137, 0, 0, 589601, 0, 0, 655136, 0, 0, 589600, 0, 0, 655135, 0, 0, 589599, 0, 0, 655134, 0, 0, 589598, 0, 0, 655133, 0, 0, 589597, 0, 0, 655132, 0, 0, 589596, 0, 0, 655131, 0, 0, 589595, 0, 0, 655130, 0, 0, 589594, 0, 0, 655129, 0, 0, 589593, 0, 0, 655128, 0, 0, 589592, 0, 0, 655127, 0, 0, 589591, 0, 0, 655126, 0, 0, 589590, 0, 0, 655125, 0, 0, 589589, 0, 0, 655124, 0, 0, 589588, 0, 0, 655123, 0, 0, 589587, 0, 0, 655122, 0, 0, 589586, 0, 0, 655121, 0, 0, 589585, 0, 0, 655120, 0, 0, 589584, 0, 0, 655119, 0, 0, 589583, 0, 0, 655118, 0, 0, 589582, 0, 0, 655117, 0, 0, 589581, 0, 0, 655116, 0, 0, 589580, 0, 0, 655115, 0, 0, 589579, 0, 0, 655114, 0, 0, 589578, 0, 0, 655113, 0, 0, 589577, 0, 0, 655112, 0, 0, 589576, 0, 0, 655111, 0, 0, 589575, 0, 0, 655110, 0, 0, 589574, 0, 0, 655109, 0, 0, 589573, 0, 0, 655108, 0, 0, 589572, 0, 0, 655107, 0, 0, 589571, 0, 0, 655106, 0, 0, 589570, 0, 0, 655105, 0, 0, 589569, 0, 0, 655104, 0, 0, 589568, 0, 0, 655103, 0, 0, 589567, 0, 0, 655102, 0, 0, 589566, 0, 0, 655101, 0, 0, 589565, 0, 0, 655100, 0, 0, 589564, 0, 0, 655099, 0, 0, 589563, 0, 0, 655098, 0, 0, 589562, 0, 0, 655097, 0, 0, 589561, 0, 0, 655096, 0, 0, 589560, 0, 0, 655095, 0, 0, 589559, 0, 0, 655094, 0, 0, 589558, 0, 0, 655093, 0, 0, 589557, 0, 0, 655092, 0, 0, 589556, 0, 0, 655091, 0, 0, 589555, 0, 0, 655090, 0, 0, 589554, 0, 0, 655089, 0, 0, 589553, 0, 0, 655088, 0, 0, 589552, 0, 0, 655087, 0, 0, 589551, 0, 0, 655086, 0, 0, 589550, 0, 0, 655085, 0, 0, 589549, 0, 0, 655084, 0, 0, 589548, 0, 0, 655083, 0, 0, 589547, 0, 0, 655082, 0, 0, 589546, 0, 0, 655081, 0, 0, 589545, 0, 0, 655080, 0, 0, 589544, 0, 0, 655079, 0, 0, 589543, 0, 0, 655078, 0, 0, 589542, 0, 0, 655077, 0, 0, 589541, 0, 0, 655076, 0, 0, 589540, 0, 0, 655075, 0, 0, 589539, 0, 0, 655074, 0, 0, 589538, 0, 0, 655073, 0, 0, 589537, 0, 0, 655072, 0, 0, 589536, 0, 0, 655071, 0, 0, 589535, 0, 0, 655070, 0, 0, 589534, 0, 0, 655069, 0, 0, 589533, 0, 0, 655068, 0, 0, 589532, 0, 0, 655067, 0, 0, 589531, 0, 0, 655066, 0, 0, 589530, 0, 0, 655065, 0, 0, 589529, 0, 0, 655064, 0, 0, 589528, 0, 0, 655063, 0, 0, 589527, 0, 0, 655062, 0, 0, 589526, 0, 0, 655061, 0, 0, 589525, 0, 0, 655060, 0, 0, 589524, 0, 0, 655059, 0, 0, 589523, 0, 0, 655058, 0, 0, 589522, 0, 0, 655057, 0, 0, 589521, 0, 0, 655056, 0, 0, 589520, 0, 0, 655055, 0, 0, 589519, 0, 0, 655054, 0, 0, 589518, 0, 0, 655053, 0, 0, 589517, 0, 0, 655052, 0, 0, 589516, 0, 0, 655051, 0, 0, 589515, 0, 0, 655050, 0, 0, 589514, 0, 0, 655049, 0, 0, 589513, 0, 0, 655048, 0, 0, 589512, 0, 0, 655047, 0, 0, 589511, 0, 0, 655046, 0, 0, 589510, 0, 0, 655045, 0, 0, 589509, 0, 0, 655044, 0, 0, 589508, 0, 0, 655043, 0, 0, 589507, 0, 0, 655042, 0, 0, 589506, 0, 0, 655041, 0, 0, 589505, 0, 0, 655040, 0, 0, 589504, 0, 0, 655039, 0, 0, 589503, 0, 0, 655038, 0, 0, 589502, 0, 0, 655037, 0, 0, 589501, 0, 0, 655036, 0, 0, 589500, 0, 0, 655035, 0, 0, 589499, 0, 0, 655034, 0, 0, 589498, 0, 0, 655033, 0, 0, 589497, 0, 0, 655032, 0, 0, 589496, 0, 0, 655031, 0, 0, 589495, 0, 0, 655030, 0, 0, 589494, 0, 0, 655029, 0, 0, 589493, 0, 0, 655028, 0, 0, 589492, 0, 0, 655027, 0, 0, 589491, 0, 0, 655026, 0, 0, 589490, 0, 0, 655025, 0, 0, 589489, 0, 0, 655024, 0, 0, 589488, 0, 0, 655023, 0, 0, 589487, 0, 0, 655022, 0, 0, 589486, 0, 0, 655021, 0, 0, 589485, 0, 0, 655020, 0, 0, 589484, 0, 0, 655019, 0, 0, 589483, 0, 0, 655018, 0, 0, 589482, 0, 0, 655017, 0, 0, 589481, 0, 0, 655016, 0, 0, 589480, 0, 0, 655015, 0, 0, 589479, 0, 0, 655014, 0, 0, 589478, 0, 0, 655013, 0, 0, 589477, 0, 0, 655012, 0, 0, 589476, 0, 0, 655011, 0, 0, 589475, 0, 0, 655010, 0, 0, 589474, 0, 0, 655009, 0, 0, 589473, 0, 0, 655008, 0, 0, 589472, 0, 0, 655007, 0, 0, 589471, 0, 0, 655006, 0, 0, 589470, 0, 0, 655005, 0, 0, 589469, 0, 0, 655004, 0, 0, 589468, 0, 0, 655003, 0, 0, 589467, 0, 0, 655002, 0, 0, 589466, 0, 0, 655001, 0, 0, 589465, 0, 0, 655000, 0, 0, 589464, 0, 0, 654999, 0, 0, 589463, 0, 0, 654998, 0, 0, 589462, 0, 0, 654997, 0, 0, 589461, 0, 0, 654996, 0, 0, 589460, 0, 0, 654995, 0, 0, 589459, 0, 0, 654994, 0, 0, 589458, 0, 0, 654993, 0, 0, 589457, 0, 0, 654992, 0, 0, 589456, 0, 0, 654991, 0, 0, 589455, 0, 0, 654990, 0, 0, 589454, 0, 0, 654989, 0, 0, 589453, 0, 0, 654988, 0, 0, 589452, 0, 0, 654987, 0, 0, 589451, 0, 0, 654986, 0, 0, 589450, 0, 0, 654985, 0, 0, 589449, 0, 0, 654984, 0, 0, 589448, 0, 0, 654983, 0, 0, 589447, 0, 0, 654982, 0, 0, 589446, 0, 0, 654981, 0, 0, 589445, 0, 0, 654980, 0, 0, 589444, 0, 0, 654979, 0, 0, 589443, 0, 0, 654978, 0, 0, 589442, 0, 0, 654977, 0, 0, 589441, 0, 0, 654976, 0, 0, 589440, 0, 0, 654975, 0, 0, 589439, 0, 0, 654974, 0, 0, 589438, 0, 0, 654973, 0, 0, 589437, 0, 0, 654972, 0, 0, 589436, 0, 0, 654971, 0, 0, 589435, 0, 0, 654970, 0, 0, 589434, 0, 0, 654969, 0, 0, 589433, 0, 0, 654968, 0, 0, 589432, 0, 0, 654967, 0, 0, 589431, 0, 0, 654966, 0, 0, 589430, 0, 0, 654965, 0, 0, 589429, 0, 0, 654964, 0, 0, 589428, 0, 0, 654963, 0, 0, 589427, 0, 0, 654962, 0, 0, 589426, 0, 0, 654961, 0, 0, 589425, 0, 0, 654960, 0, 0, 589424, 0, 0, 654959, 0, 0, 589423, 0, 0, 654958, 0, 0, 589422, 0, 0, 654957, 0, 0, 589421, 0, 0, 654956, 0, 0, 589420, 0, 0, 654955, 0, 0, 589419, 0, 0, 654954, 0, 0, 589418, 0, 0, 654953, 0, 0, 589417, 0, 0, 654952, 0, 0, 589416, 0, 0, 654951, 0, 0, 589415, 0, 0, 654950, 0, 0, 589414, 0, 0, 654949, 0, 0, 589413, 0, 0, 654948, 0, 0, 589412, 0, 0, 654947, 0, 0, 589411, 0, 0, 654946, 0, 0, 589410, 0, 0, 654945, 0, 0, 589409, 0, 0, 654944, 0, 0, 589408, 0, 0, 654943, 0, 0, 589407, 0, 0, 654942, 0, 0, 589406, 0, 0, 654941, 0, 0, 589405, 0, 0, 654940, 0, 0, 589404, 0, 0, 654939, 0, 0, 589403, 0, 0, 654938, 0, 0, 589402, 0, 0, 654937, 0, 0, 589401, 0, 0, 654936, 0, 0, 589400, 0, 0, 654935, 0, 0, 589399, 0, 0, 654934, 0, 0, 589398, 0, 0, 654933, 0, 0, 589397, 0, 0, 654932, 0, 0, 589396, 0, 0, 654931, 0, 0, 589395, 0, 0, 654930, 0, 0, 589394, 0, 0, 654929, 0, 0, 589393, 0, 0, 654928, 0, 0, 589392, 0, 0, 654927, 0, 0, 589391, 0, 0, 654926, 0, 0, 589390, 0, 0, 654925, 0, 0, 589389, 0, 0, 654924, 0, 0, 589388, 0, 0, 654923, 0, 0, 589387, 0, 0, 654922, 0, 0, 589386, 0, 0, 654921, 0, 0, 589385, 0, 0, 654920, 0, 0, 589384, 0, 0, 654919, 0, 0, 589383, 0, 0, 654918, 0, 0, 589382, 0, 0, 654917, 0, 0, 589381, 0, 0, 654916, 0, 0, 589380, 0, 0, 654915, 0, 0, 589379, 0, 0, 654914, 0, 0, 589378, 0, 0, 654913, 0, 0, 589377, 0, 0, 654912, 0, 0, 589376, 0, 0, 654911, 0, 0, 589375, 0, 0, 654910, 0, 0, 589374, 0, 0, 654909, 0, 0, 589373, 0, 0, 654908, 0, 0, 589372, 0, 0, 654907, 0, 0, 589371, 0, 0, 654906, 0, 0, 589370, 0, 0, 654905, 0, 0, 589369, 0, 0, 654904, 0, 0, 589368, 0, 0, 654903, 0, 0, 589367, 0, 0, 654902, 0, 0, 589366, 0, 0, 654901, 0, 0, 589365, 0, 0, 654900, 0, 0, 589364, 0, 0, 654899, 0, 0, 589363, 0, 0, 654898, 0, 0, 589362, 0, 0, 654897, 0, 0, 589361, 0, 0, 654896, 0, 0, 589360, 0, 0, 654895, 0, 0, 589359, 0, 0, 654894, 0, 0, 589358, 0, 0, 654893, 0, 0, 589357, 0, 0, 654892, 0, 0, 589356, 0, 0, 654891, 0, 0, 589355, 0, 0, 654890, 0, 0, 589354, 0, 0, 654889, 0, 0, 589353, 0, 0, 654888, 0, 0, 589352, 0, 0, 654887, 0, 0, 589351, 0, 0, 654886, 0, 0, 589350, 0, 0, 654885, 0, 0, 589349, 0, 0, 654884, 0, 0, 589348, 0, 0, 654883, 0, 0, 589347, 0, 0, 654882, 0, 0, 589346, 0, 0, 654881, 0, 0, 589345, 0, 0, 654880, 0, 0, 589344, 0, 0, 654879, 0, 0, 589343, 0, 0, 654878, 0, 0, 589342, 0, 0, 654877, 0, 0, 589341, 0, 0, 654876, 0, 0, 589340, 0, 0, 654875, 0, 0, 589339, 0, 0, 654874, 0, 0, 589338, 0, 0, 654873, 0, 0, 589337, 0, 0, 654872, 0, 0, 589336, 0, 0, 654871, 0, 0, 589335, 0, 0, 654870, 0, 0, 589334, 0, 0, 654869, 0, 0, 589333, 0, 0, 654868, 0, 0, 589332, 0, 0, 654867, 0, 0, 589331, 0, 0, 654866, 0, 0, 589330, 0, 0, 654865, 0, 0, 589329, 0, 0, 654864, 0, 0, 589328, 0, 0, 654863, 0, 0, 589327, 0, 0, 654862, 0, 0, 589326, 0, 0, 654861, 0, 0, 589325, 0, 0, 654860, 0, 0, 589324, 0, 0, 654859, 0, 0, 589323, 0, 0, 654858, 0, 0, 589322, 0, 0, 654857, 0, 0, 589321, 0, 0, 654856, 0, 0, 589320, 0, 0, 654855, 0, 0, 589319, 0, 0, 654854, 0, 0, 589318, 0, 0, 654853, 0, 0, 589317, 0, 0, 654852, 0, 0, 589316, 0, 0, 654851, 0, 0, 589315, 0, 0, 654850, 0, 0, 589314, 0, 0, 654849, 0, 0, 589313, 0, 0, 654848, 0, 0, 589312, 0, 0, 654847, 0, 0, 589311, 0, 0, 654846, 0, 0, 589310, 0, 0, 654845, 0, 0, 589309, 0, 0, 654844, 0, 0, 589308, 0, 0, 654843, 0, 0, 589307, 0, 0, 654842, 0, 0, 589306, 0, 0, 654841, 0, 0, 589305, 0, 0, 654840, 0, 0, 589304, 0, 0, 654839, 0, 0, 589303, 0, 0, 654838, 0, 0, 589302, 0, 0, 654837, 0, 0, 589301, 0, 0, 654836, 0, 0, 589300, 0, 0, 654835, 0, 0, 589299, 0, 0, 654834, 0, 0, 589298, 0, 0, 654833, 0, 0, 589297, 0, 0, 654832, 0, 0, 589296, 0, 0, 654831, 0, 0, 589295, 0, 0, 654830, 0, 0, 589294, 0, 0, 654829, 0, 0, 589293, 0, 0, 654828, 0, 0, 589292, 0, 0, 654827, 0, 0, 589291, 0, 0, 654826, 0, 0, 589290, 0, 0, 654825, 0, 0, 589289, 0, 0, 654824, 0, 0, 589288, 0, 0, 654823, 0, 0, 589287, 0, 0, 654822, 0, 0, 589286, 0, 0, 654821, 0, 0, 589285, 0, 0, 654820, 0, 0, 589284, 0, 0, 654819, 0, 0, 589283, 0, 0, 654818, 0, 0, 589282, 0, 0, 654817, 0, 0, 589281, 0, 0, 654816, 0, 0, 589280, 0, 0, 654815, 0, 0, 589279, 0, 0, 654814, 0, 0, 589278, 0, 0, 654813, 0, 0, 589277, 0, 0, 654812, 0, 0, 589276, 0, 0, 654811, 0, 0, 589275, 0, 0, 654810, 0, 0, 589274, 0, 0, 654809, 0, 0, 589273, 0, 0, 654808, 0, 0, 589272, 0, 0, 654807, 0, 0, 589271, 0, 0, 654806, 0, 0, 589270, 0, 0, 654805, 0, 0, 589269, 0, 0, 654804, 0, 0, 589268, 0, 0, 654803, 0, 0, 589267, 0, 0, 654802, 0, 0, 589266, 0, 0, 654801, 0, 0, 589265, 0, 0, 654800, 0, 0, 589264, 0, 0, 654799, 0, 0, 589263, 0, 0, 654798, 0, 0, 589262, 0, 0, 654797, 0, 0, 589261, 0, 0, 654796, 0, 0, 589260, 0, 0, 654795, 0, 0, 589259, 0, 0, 654794, 0, 0, 589258, 0, 0, 654793, 0, 0, 589257, 0, 0, 654792, 0, 0, 589256, 0, 0, 654791, 0, 0, 589255, 0, 0, 654790, 0, 0, 589254, 0, 0, 654789, 0, 0, 589253, 0, 0, 654788, 0, 0, 589252, 0, 0, 654787, 0, 0, 589251, 0, 0, 654786, 0, 0, 589250, 0, 0, 654785, 0, 0, 589249, 0, 0, 654784, 0, 0, 589248, 0, 0, 654783, 0, 0, 589247, 0, 0, 654782, 0, 0, 589246, 0, 0, 654781, 0, 0, 589245, 0, 0, 654780, 0, 0, 589244, 0, 0, 654779, 0, 0, 589243, 0, 0, 654778, 0, 0, 589242, 0, 0, 654777, 0, 0, 589241, 0, 0, 654776, 0, 0, 589240, 0, 0, 654775, 0, 0, 589239, 0, 0, 654774, 0, 0, 589238, 0, 0, 654773, 0, 0, 589237, 0, 0, 654772, 0, 0, 589236, 0, 0, 654771, 0, 0, 589235, 0, 0, 654770, 0, 0, 589234, 0, 0, 654769, 0, 0, 589233, 0, 0, 654768, 0, 0, 589232, 0, 0, 654767, 0, 0, 589231, 0, 0, 654766, 0, 0, 589230, 0, 0, 654765, 0, 0, 589229, 0, 0, 654764, 0, 0, 589228, 0, 0, 654763, 0, 0, 589227, 0, 0, 654762, 0, 0, 589226, 0, 0, 654761, 0, 0, 589225, 0, 0, 654760, 0, 0, 589224, 0, 0, 654759, 0, 0, 589223, 0, 0, 654758, 0, 0, 589222, 0, 0, 654757, 0, 0, 589221, 0, 0, 654756, 0, 0, 589220, 0, 0, 654755, 0, 0, 589219, 0, 0, 654754, 0, 0, 589218, 0, 0, 654753, 0, 0, 589217, 0, 0, 654752, 0, 0, 589216, 0, 0, 654751, 0, 0, 589215, 0, 0, 654750, 0, 0, 589214, 0, 0, 654749, 0, 0, 589213, 0, 0, 654748, 0, 0, 589212, 0, 0, 654747, 0, 0, 589211, 0, 0, 654746, 0, 0, 589210, 0, 0, 654745, 0, 0, 589209, 0, 0, 654744, 0, 0, 589208, 0, 0, 654743, 0, 0, 589207, 0, 0, 654742, 0, 0, 589206, 0, 0, 654741, 0, 0, 589205, 0, 0, 654740, 0, 0, 589204, 0, 0, 654739, 0, 0, 589203, 0, 0, 654738, 0, 0, 589202, 0, 0, 654737, 0, 0, 589201, 0, 0, 654736, 0, 0, 589200, 0, 0, 654735, 0, 0, 589199, 0, 0, 654734, 0, 0, 589198, 0, 0, 654733, 0, 0, 589197, 0, 0, 654732, 0, 0, 589196, 0, 0, 654731, 0, 0, 589195, 0, 0, 654730, 0, 0, 589194, 0, 0, 654729, 0, 0, 589193, 0, 0, 654728, 0, 0, 589192, 0, 0, 654727, 0, 0, 589191, 0, 0, 654726, 0, 0, 589190, 0, 0, 654725, 0, 0, 589189, 0, 0, 654724, 0, 0, 589188, 0, 0, 654723, 0, 0, 589187, 0, 0, 654722, 0, 0, 589186, 0, 0, 654721, 0, 0, 589185, 0, 0, 654720, 0, 0, 589184, 0, 0, 654719, 0, 0, 589183, 0, 0, 654718, 0, 0, 589182, 0, 0, 654717, 0, 0, 589181, 0, 0, 654716, 0, 0, 589180, 0, 0, 654715, 0, 0, 589179, 0, 0, 654714, 0, 0, 589178, 0, 0, 654713, 0, 0, 589177, 0, 0, 654712, 0, 0, 589176, 0, 0, 654711, 0, 0, 589175, 0, 0, 654710, 0, 0, 589174, 0, 0, 654709, 0, 0, 589173, 0, 0, 654708, 0, 0, 589172, 0, 0, 654707, 0, 0, 589171, 0, 0, 654706, 0, 0, 589170, 0, 0, 654705, 0, 0, 589169, 0, 0, 654704, 0, 0, 589168, 0, 0, 654703, 0, 0, 589167, 0, 0, 654702, 0, 0, 589166, 0, 0, 654701, 0, 0, 589165, 0, 0, 654700, 0, 0, 589164, 0, 0, 654699, 0, 0, 589163, 0, 0, 654698, 0, 0, 589162, 0, 0, 654697, 0, 0, 589161, 0, 0, 654696, 0, 0, 589160, 0, 0, 654695, 0, 0, 589159, 0, 0, 654694, 0, 0, 589158, 0, 0, 654693, 0, 0, 589157, 0, 0, 654692, 0, 0, 589156, 0, 0, 654691, 0, 0, 589155, 0, 0, 654690, 0, 0, 589154, 0, 0, 654689, 0, 0, 589153, 0, 0, 654688, 0, 0, 589152, 0, 0, 654687, 0, 0, 589151, 0, 0, 654686, 0, 0, 589150, 0, 0, 654685, 0, 0, 589149, 0, 0, 654684, 0, 0, 589148, 0, 0, 654683, 0, 0, 589147, 0, 0, 654682, 0, 0, 589146, 0, 0, 654681, 0, 0, 589145, 0, 0, 654680, 0, 0, 589144, 0, 0, 654679, 0, 0, 589143, 0, 0, 654678, 0, 0, 589142, 0, 0, 654677, 0, 0, 589141, 0, 0, 654676, 0, 0, 589140, 0, 0, 654675, 0, 0, 589139, 0, 0, 654674, 0, 0, 589138, 0, 0, 654673, 0, 0, 589137, 0, 0, 654672, 0, 0, 589136, 0, 0, 654671, 0, 0, 589135, 0, 0, 654670, 0, 0, 589134, 0, 0, 654669, 0, 0, 589133, 0, 0, 654668, 0, 0, 589132, 0, 0, 654667, 0, 0, 589131, 0, 0, 654666, 0, 0, 589130, 0, 0, 654665, 0, 0, 589129, 0, 0, 654664, 0, 0, 589128, 0, 0, 654663, 0, 0, 589127, 0, 0, 654662, 0, 0, 589126, 0, 0, 654661, 0, 0, 589125, 0, 0, 654660, 0, 0, 589124, 0, 0, 654659, 0, 0, 589123, 0, 0, 654658, 0, 0, 589122, 0, 0, 654657, 0, 0, 589121, 0, 0, 654656, 0, 0, 589120, 0, 0, 654655, 0, 0, 589119, 0, 0, 654654, 0, 0, 589118, 0, 0, 654653, 0, 0, 589117, 0, 0, 654652, 0, 0, 589116, 0, 0, 654651, 0, 0, 589115, 0, 0, 654650, 0, 0, 589114, 0, 0, 654649, 0, 0, 589113, 0, 0, 654648, 0, 0, 589112, 0, 0, 654647, 0, 0, 589111, 0, 0, 654646, 0, 0, 589110, 0, 0, 654645, 0, 0, 589109, 0, 0, 654644, 0, 0, 589108, 0, 0, 654643, 0, 0, 589107, 0, 0, 654642, 0, 0, 589106, 0, 0, 654641, 0, 0, 589105, 0, 0, 654640, 0, 0, 589104, 0, 0, 654639, 0, 0, 589103, 0, 0, 654638, 0, 0, 589102, 0, 0, 654637, 0, 0, 589101, 0, 0, 654636, 0, 0, 589100, 0, 0, 654635, 0, 0, 589099, 0, 0, 654634, 0, 0, 589098, 0, 0, 654633, 0, 0, 589097, 0, 0, 654632, 0, 0, 589096, 0, 0, 654631, 0, 0, 589095, 0, 0, 654630, 0, 0, 589094, 0, 0, 654629, 0, 0, 589093, 0, 0, 654628, 0, 0, 589092, 0, 0, 654627, 0, 0, 589091, 0, 0, 654626, 0, 0, 589090, 0, 0, 654625, 0, 0, 589089, 0, 0, 654624, 0, 0, 589088, 0, 0, 654623, 0, 0, 589087, 0, 0, 654622, 0, 0, 589086, 0, 0, 654621, 0, 0, 589085, 0, 0, 654620, 0, 0, 589084, 0, 0, 654619, 0, 0, 589083, 0, 0, 654618, 0, 0, 589082, 0, 0, 654617, 0, 0, 589081, 0, 0, 654616, 0, 0, 589080, 0, 0, 654615, 0, 0, 589079, 0, 0, 654614, 0, 0, 589078, 0, 0, 654613, 0, 0, 589077, 0, 0, 654612, 0, 0, 589076, 0, 0, 654611, 0, 0, 589075, 0, 0, 654610, 0, 0, 589074, 0, 0, 654609, 0, 0, 589073, 0, 0, 654608, 0, 0, 589072, 0, 0, 654607, 0, 0, 589071, 0, 0, 654606, 0, 0, 589070, 0, 0, 654605, 0, 0, 589069, 0, 0, 654604, 0, 0, 589068, 0, 0, 654603, 0, 0, 589067, 0, 0, 654602, 0, 0, 589066, 0, 0, 654601, 0, 0, 589065, 0, 0, 654600, 0, 0, 589064, 0, 0, 654599, 0, 0, 589063, 0, 0, 654598, 0, 0, 589062, 0, 0, 654597, 0, 0, 589061, 0, 0, 654596, 0, 0, 589060, 0, 0, 654595, 0, 0, 589059, 0, 0, 654594, 0, 0, 589058, 0, 0, 654593, 0, 0, 589057, 0, 0, 654592, 0, 0, 589056, 0, 0, 654591, 0, 0, 589055, 0, 0, 654590, 0, 0, 589054, 0, 0, 654589, 0, 0, 589053, 0, 0, 654588, 0, 0, 589052, 0, 0, 654587, 0, 0, 589051, 0, 0, 654586, 0, 0, 589050, 0, 0, 654585, 0, 0, 589049, 0, 0, 654584, 0, 0, 589048, 0, 0, 654583, 0, 0, 589047, 0, 0, 654582, 0, 0, 589046, 0, 0, 654581, 0, 0, 589045, 0, 0, 654580, 0, 0, 589044, 0, 0, 654579, 0, 0, 589043, 0, 0, 654578, 0, 0, 589042, 0, 0, 654577, 0, 0, 589041, 0, 0, 654576, 0, 0, 589040, 0, 0, 654575, 0, 0, 589039, 0, 0, 654574, 0, 0, 589038, 0, 0, 654573, 0, 0, 589037, 0, 0, 654572, 0, 0, 589036, 0, 0, 654571, 0, 0, 589035, 0, 0, 654570, 0, 0, 589034, 0, 0, 654569, 0, 0, 589033, 0, 0, 654568, 0, 0, 589032, 0, 0, 654567, 0, 0, 589031, 0, 0, 654566, 0, 0, 589030, 0, 0, 654565, 0, 0, 589029, 0, 0, 654564, 0, 0, 589028, 0, 0, 654563, 0, 0, 589027, 0, 0, 654562, 0, 0, 589026, 0, 0, 654561, 0, 0, 589025, 0, 0, 654560, 0, 0, 589024, 0, 0, 654559, 0, 0, 589023, 0, 0, 654558, 0, 0, 589022, 0, 0, 654557, 0, 0, 589021, 0, 0, 654556, 0, 0, 589020, 0, 0, 654555, 0, 0, 589019, 0, 0, 654554, 0, 0, 589018, 0, 0, 654553, 0, 0, 589017, 0, 0, 654552, 0, 0, 589016, 0, 0, 654551, 0, 0, 589015, 0, 0, 654550, 0, 0, 589014, 0, 0, 654549, 0, 0, 589013, 0, 0, 654548, 0, 0, 589012, 0, 0, 654547, 0, 0, 589011, 0, 0, 654546, 0, 0, 589010, 0, 0, 654545, 0, 0, 589009, 0, 0, 654544, 0, 0, 589008, 0, 0, 654543, 0, 0, 589007, 0, 0, 654542, 0, 0, 589006, 0, 0, 654541, 0, 0, 589005, 0, 0, 654540, 0, 0, 589004, 0, 0, 654539, 0, 0, 589003, 0, 0, 654538, 0, 0, 589002, 0, 0, 654537, 0, 0, 589001, 0, 0, 654536, 0, 0, 589000, 0, 0, 654535, 0, 0, 588999, 0, 0, 654534, 0, 0, 588998, 0, 0, 654533, 0, 0, 588997, 0, 0, 654532, 0, 0, 588996, 0, 0, 654531, 0, 0, 588995, 0, 0, 654530, 0, 0, 588994, 0, 0, 654529, 0, 0, 588993, 0, 0, 654528, 0, 0, 588992, 0, 0, 654527, 0, 0, 588991, 0, 0, 654526, 0, 0, 588990, 0, 0, 654525, 0, 0, 588989, 0, 0, 654524, 0, 0, 588988, 0, 0, 654523, 0, 0, 588987, 0, 0, 654522, 0, 0, 588986, 0, 0, 654521, 0, 0, 588985, 0, 0, 654520, 0, 0, 588984, 0, 0, 654519, 0, 0, 588983, 0, 0, 654518, 0, 0, 588982, 0, 0, 654517, 0, 0, 588981, 0, 0, 654516, 0, 0, 588980, 0, 0, 654515, 0, 0, 588979, 0, 0, 654514, 0, 0, 588978, 0, 0, 654513, 0, 0, 588977, 0, 0, 654512, 0, 0, 588976, 0, 0, 654511, 0, 0, 588975, 0, 0, 654510, 0, 0, 588974, 0, 0, 654509, 0, 0, 588973, 0, 0, 654508, 0, 0, 588972, 0, 0, 654507, 0, 0, 588971, 0, 0, 654506, 0, 0, 588970, 0, 0, 654505, 0, 0, 588969, 0, 0, 654504, 0, 0, 588968, 0, 0, 654503, 0, 0, 588967, 0, 0, 654502, 0, 0, 588966, 0, 0, 654501, 0, 0, 588965, 0, 0, 654500, 0, 0, 588964, 0, 0, 654499, 0, 0, 588963, 0, 0, 654498, 0, 0, 588962, 0, 0, 654497, 0, 0, 588961, 0, 0, 654496, 0, 0, 588960, 0, 0, 654495, 0, 0, 588959, 0, 0, 654494, 0, 0, 588958, 0, 0, 654493, 0, 0, 588957, 0, 0, 654492, 0, 0, 588956, 0, 0, 654491, 0, 0, 588955, 0, 0, 654490, 0, 0, 588954, 0, 0, 654489, 0, 0, 588953, 0, 0, 654488, 0, 0, 588952, 0, 0, 654487, 0, 0, 588951, 0, 0, 654486, 0, 0, 588950, 0, 0, 654485, 0, 0, 588949, 0, 0, 654484, 0, 0, 588948, 0, 0, 654483, 0, 0, 588947, 0, 0, 654482, 0, 0, 588946, 0, 0, 654481, 0, 0, 588945, 0, 0, 654480, 0, 0, 588944, 0, 0, 654479, 0, 0, 588943, 0, 0, 654478, 0, 0, 588942, 0, 0, 654477, 0, 0, 588941, 0, 0, 654476, 0, 0, 588940, 0, 0, 654475, 0, 0, 588939, 0, 0, 654474, 0, 0, 588938, 0, 0, 654473, 0, 0, 588937, 0, 0, 654472, 0, 0, 588936, 0, 0, 654471, 0, 0, 588935, 0, 0, 654470, 0, 0, 588934, 0, 0, 654469, 0, 0, 588933, 0, 0, 654468, 0, 0, 588932, 0, 0, 654467, 0, 0, 588931, 0, 0, 654466, 0, 0, 588930, 0, 0, 654465, 0, 0, 588929, 0, 0, 654464, 0, 0, 588928, 0, 0, 654463, 0, 0, 588927, 0, 0, 654462, 0, 0, 588926, 0, 0, 654461, 0, 0, 588925, 0, 0, 654460, 0, 0, 588924, 0, 0, 654459, 0, 0, 588923, 0, 0, 654458, 0, 0, 588922, 0, 0, 654457, 0, 0, 588921, 0, 0, 654456, 0, 0, 588920, 0, 0, 654455, 0, 0, 588919, 0, 0, 654454, 0, 0, 588918, 0, 0, 654453, 0, 0, 588917, 0, 0, 654452, 0, 0, 588916, 0, 0, 654451, 0, 0, 588915, 0, 0, 654450, 0, 0, 588914, 0, 0, 654449, 0, 0, 588913, 0, 0, 654448, 0, 0, 588912, 0, 0, 654447, 0, 0, 588911, 0, 0) [node name="TileMap2" type="TileMap" parent="Map"] modulate = Color(0, 0, 0.486275, 1) @@ -49,5 +53,12 @@ format = 2 layer_0/tile_data = PackedInt32Array(589824, 0, 0, 589825, 0, 0, 589826, 0, 0, 589827, 0, 0, 589828, 0, 0, 589829, 0, 0, 589830, 0, 0, 589831, 0, 0, 589832, 0, 0, 589833, 0, 0, 589834, 0, 0, 589835, 0, 0, 589836, 0, 0, 589837, 0, 0, 589838, 0, 0, 589839, 0, 0, 589840, 0, 0, 589841, 0, 0, 655359, 0, 0, 655358, 0, 0, 655357, 0, 0, 655356, 0, 0, 655355, 0, 0, 655354, 0, 0, 655353, 0, 0, 655352, 0, 0, 655351, 0, 0, 589815, 0, 0, 589816, 0, 0, 589817, 0, 0, 589818, 0, 0, 589819, 0, 0, 589820, 0, 0, 589821, 0, 0, 589822, 0, 0, 589823, 0, 0, 524288, 0, 0, 524289, 0, 0, 524299, 0, 0, 524292, 0, 0, 524291, 0, 0, 524290, 0, 0, 524298, 0, 0, 524297, 0, 0, 524296, 0, 0, 524295, 0, 0, 524293, 0, 0, 524294, 0, 0, 524300, 0, 0, 524301, 0, 0, 524302, 0, 0, 524303, 0, 0, 524304, 0, 0, 524305, 0, 0, 524306, 0, 0, 589842, 0, 0, 655350, 0, 0, 589814, 0, 0, 524278, 0, 0, 458742, 0, 0, 393206, 0, 0, 327670, 0, 0, 262134, 0, 0, 196598, 0, 0, 131062, 0, 0, 65526, 0, 0, -10, 0, 0, -65546, 0, 0, -131082, 0, 0, -196618, 0, 0, -262154, 0, 0, 655349, 0, 0, 589813, 0, 0, 524277, 0, 0, 458741, 0, 0, 393205, 0, 0, 327669, 0, 0, 262133, 0, 0, 196597, 0, 0, 131061, 0, 0, 65525, 0, 0, -11, 0, 0, -65547, 0, 0, -131083, 0, 0, -196619, 0, 0, -262155, 0, 0, 655348, 0, 0, 589812, 0, 0, 655347, 0, 0, 589811, 0, 0, 655346, 0, 0, 589810, 0, 0, 655345, 0, 0, 589809, 0, 0, 655344, 0, 0, 589808, 0, 0, 655343, 0, 0, 589807, 0, 0, 655342, 0, 0, 589806, 0, 0, 655341, 0, 0, 589805, 0, 0, 655340, 0, 0, 589804, 0, 0, 655339, 0, 0, 589803, 0, 0, 655338, 0, 0, 589802, 0, 0, 458764, 0, 0, 393228, 0, 0, 327692, 0, 0, 262156, 0, 0, 196620, 0, 0, 131084, 0, 0, 65548, 0, 0, 12, 0, 0, 458763, 0, 0, 393227, 0, 0, 327691, 0, 0, 262155, 0, 0, 196619, 0, 0, 131083, 0, 0, 65547, 0, 0, 11, 0, 0, 589852, 0, 0, 524316, 0, 0, 589851, 0, 0, 524315, 0, 0, 589850, 0, 0, 524314, 0, 0, 589849, 0, 0, 524313, 0, 0, 589848, 0, 0, 524312, 0, 0, 589847, 0, 0, 524311, 0, 0, 589846, 0, 0, 524310, 0, 0, 589845, 0, 0, 524309, 0, 0, 589844, 0, 0, 524308, 0, 0, 589843, 0, 0, 524307, 0, 0) [node name="Player" parent="." instance=ExtResource("1_jcngi")] +collision_layer = 3 +collision_mask = 1 floor_constant_speed = true floor_snap_length = 1.0 + +[node name="GUI" parent="Player" instance=ExtResource("4_7j33c")] + +[node name="Smoother" type="Node" parent="."] +script = ExtResource("3_16g5e") diff --git a/Player/BasicCharacter/AnimationController.gd b/Player/BasicCharacter/AnimationController.gd index 9fca59e..76d8438 100644 --- a/Player/BasicCharacter/AnimationController.gd +++ b/Player/BasicCharacter/AnimationController.gd @@ -2,38 +2,54 @@ extends Sprite2D @onready var player = $"../" -@onready var wallSlidingParticles = $"WallslidingParticles" +var spinAccel = 0 func spin(veloc, delta): var vertSpinMult = abs(veloc.y) * clamp(veloc.x, -1, 1) / 1.5 var spinFactor = (veloc.x + vertSpinMult) / 30 - if player.direction: + if player.direction or abs(player.velocity.x) > 100: rotation = lerp(rotation, rotation + (spinFactor), delta) else: - rotation = lerp(rotation, snappedf(rotation, PI / 2), delta * 10) + rotation = lerp(rotation, snappedf(rotation + (spinFactor * delta * 2), PI / 2), delta * 5) var landed = 0 +@onready var slidingVariants = [$"WallslidingNeutral", $"WallslidingUp", $"WallslidingDown"] + +func disableSlidingVariants(keep=null): + for variant in slidingVariants: + if variant != keep: + variant.emitting = false + func _process(delta): var velocity = player.velocity + var grapple = $"GrappleCore" var floored = player.is_on_floor() - if player.is_on_wall_only() and velocity.y > 0: + if player.isWallSliding(): + var wallSlidingParticles = slidingVariants[0] + if abs(velocity.y) < 150: + wallSlidingParticles = slidingVariants[1] + elif abs(velocity.y) > 300: + wallSlidingParticles = slidingVariants[2] + + disableSlidingVariants(wallSlidingParticles) wallSlidingParticles.emitting = true - wallSlidingParticles.global_position = player.position + (player.get_wall_normal() * -8) + wallSlidingParticles.global_position = player.position + (player.get_wall_normal() * -8 * player.scale.x) wallSlidingParticles.global_rotation = player.get_wall_normal().x * deg_to_rad(45) + else: - wallSlidingParticles.emitting = false + disableSlidingVariants() if not floored: spin(velocity, delta) landed = velocity.y - scale = Vector2.ONE + #scale = Vector2.ONE - if player.is_on_wall(): + if player.isWallSliding(): rotation = lerp(rotation, deg_to_rad(30) * player.get_wall_normal().x + snappedf(rotation, PI / 2), delta * 15) else: var floorRot = player.get_floor_normal().angle() + (PI / 2) @@ -52,8 +68,18 @@ func _process(delta): scale.y = lerp(scale.y, 1.0, delta * 7) scale.x = lerp(scale.x, 1.0, delta * 7) - scale.y = clamp(scale.y, 0.1, INF) + scale.y = clamp(scale.y, 0.25, INF) scale.x = clamp(scale.x, 0.1, INF) + #modulate.h = abs(player.position.x / 400.) offset.y = (8 * pow(scale.y, -1) - 8) offset.x = 0 + + grapple.offset = offset + + +func _on_character_jumped(): + if not player.direction: + rotation = 0 + scale.y = 1.5 + scale.x = 0.5 diff --git a/Player/BasicCharacter/CameraController.gd b/Player/BasicCharacter/CameraController.gd deleted file mode 100644 index 968a926..0000000 --- a/Player/BasicCharacter/CameraController.gd +++ /dev/null @@ -1,4 +0,0 @@ -extends Camera2D - -func _process(delta): - position = get_local_mouse_position() / 3 diff --git a/Player/BasicCharacter/Character.tscn b/Player/BasicCharacter/Character.tscn index ed4b993..1841549 100644 --- a/Player/BasicCharacter/Character.tscn +++ b/Player/BasicCharacter/Character.tscn @@ -1,9 +1,11 @@ -[gd_scene load_steps=9 format=3 uid="uid://cqcjan67wgkc1"] +[gd_scene load_steps=11 format=3 uid="uid://cqcjan67wgkc1"] [ext_resource type="Texture2D" uid="uid://dvx8lliqdi3dv" path="res://Player/Skins/Square/Square.png" id="1_3vfyw"] [ext_resource type="Script" path="res://Player/BasicCharacter/CharacterController.gd" id="1_c5ycp"] -[ext_resource type="Script" path="res://Player/BasicCharacter/CameraController.gd" id="3_2bdku"] +[ext_resource type="PackedScene" uid="uid://cjjrxtvufk35a" path="res://Player/Camera/camera.tscn" id="2_oahgu"] [ext_resource type="Script" path="res://Player/BasicCharacter/AnimationController.gd" id="3_6plye"] +[ext_resource type="Script" path="res://Player/GrappleHook/GrappleHook.gd" id="5_sv1u0"] +[ext_resource type="Texture2D" uid="uid://bi5ofgcvid5qk" path="res://Player/GrappleHook/GrappleCenter.png" id="6_ismrc"] [sub_resource type="CircleShape2D" id="CircleShape2D_jbiem"] radius = 8.0 @@ -28,27 +30,52 @@ scale_max = 2.0 scale_curve = SubResource("CurveTexture_d404m") [node name="Character" type="CharacterBody2D"] +collision_mask = 7 +floor_stop_on_slope = false floor_snap_length = 3.0 script = ExtResource("1_c5ycp") -[node name="Camera" type="Camera2D" parent="."] -zoom = Vector2(3, 3) -position_smoothing_enabled = true -position_smoothing_speed = 35.0 -script = ExtResource("3_2bdku") +[node name="Camera" parent="." instance=ExtResource("2_oahgu")] +position_smoothing_speed = 20.0 [node name="BoxCollider" type="CollisionShape2D" parent="."] shape = SubResource("CircleShape2D_jbiem") [node name="Sprite" type="Sprite2D" parent="."] -self_modulate = Color(1, 0, 0, 1) +self_modulate = Color(0.678431, 0.298039, 1, 1) +visibility_layer = 257 rotation = 0.0123838 texture = ExtResource("1_3vfyw") script = ExtResource("3_6plye") -[node name="WallslidingParticles" type="GPUParticles2D" parent="Sprite"] +[node name="WallslidingUp" type="GPUParticles2D" parent="Sprite"] show_behind_parent = true top_level = true position = Vector2(-7.79423, 4.5) -rotation = 0.785398 +emitting = false process_material = SubResource("ParticleProcessMaterial_65t6y") + +[node name="WallslidingNeutral" type="GPUParticles2D" parent="Sprite"] +show_behind_parent = true +top_level = true +position = Vector2(-7.79423, 4.5) +emitting = false +amount = 16 +process_material = SubResource("ParticleProcessMaterial_65t6y") + +[node name="WallslidingDown" type="GPUParticles2D" parent="Sprite"] +show_behind_parent = true +top_level = true +position = Vector2(-7.79423, 4.5) +emitting = false +amount = 24 +process_material = SubResource("ParticleProcessMaterial_65t6y") + +[node name="Grapple" type="Node2D" parent="Sprite"] +script = ExtResource("5_sv1u0") + +[node name="GrappleCore" type="Sprite2D" parent="Sprite"] +modulate = Color(0.513726, 1, 0.482353, 1) +texture = ExtResource("6_ismrc") + +[connection signal="Jumped" from="." to="Sprite" method="_on_character_jumped"] diff --git a/Player/BasicCharacter/CharacterController.gd b/Player/BasicCharacter/CharacterController.gd index 3232d1a..4da1030 100644 --- a/Player/BasicCharacter/CharacterController.gd +++ b/Player/BasicCharacter/CharacterController.gd @@ -2,72 +2,87 @@ extends CharacterBody2D const SPEED = 400.0 const ACCEL = 7.0 +var direction = 0 +var addedveloc = 0 const JUMP_VELOCITY = -450.0 - const MAX_JUMPS = 2 var jumps = MAX_JUMPS +var wallKayote = 0 const FALL_SPEED = -JUMP_VELOCITY * 1.5 var falling = false +var floorTime = 0 + var gravity = ProjectSettings.get_setting("physics/2d/default_gravity") -var direction = 0 - -var addedveloc = 0 - -var wallKayote = 0 +func isWallSliding(): + return is_on_wall_only() and direction func launch(veloc): addedveloc = veloc velocity.x = veloc +signal Jumped + func _physics_process(delta): direction = round(Input.get_axis("left", "right")) wallKayote -= delta if not is_on_floor(): - var lowGrav = velocity.y < 0 and Input.is_action_pressed("jump") - + var lowGrav = velocity.y < 0 and (Input.is_action_pressed("up") or Input.is_action_pressed("jump")) velocity.y += gravity * delta / gen.boolToNumb(lowGrav, 1) + + floorTime = 0 else: + floorTime += delta jumps = MAX_JUMPS falling = false - if is_on_wall_only() and direction: - wallKayote = 0.225 + if isWallSliding(): + wallKayote = 0.2 + falling = false - print(-get_wall_normal().x, direction) + if Input.is_action_just_pressed("respawn") or position.y > 500: + position = Vector2.ZERO + velocity = Vector2.ZERO if Input.is_action_just_pressed("jump"): - if wallKayote > 0: - velocity.y = clamp(velocity.y + JUMP_VELOCITY, -INF, JUMP_VELOCITY) - launch(get_wall_normal().x * SPEED) + if wallKayote > 0 and not is_on_floor(): + wallKayote /= 2 + if Input.is_action_pressed("down"): + launch(get_wall_normal().x * SPEED * 2.5) + velocity.y = JUMP_VELOCITY / 2 + else: + launch(get_wall_normal().x * SPEED * 1.5) + velocity.y = clamp(velocity.y + JUMP_VELOCITY, -INF, JUMP_VELOCITY) elif jumps > 0: + Jumped.emit() velocity.y = clamp(velocity.y + JUMP_VELOCITY, -INF, JUMP_VELOCITY) jumps -= 1 falling = false - - if Input.is_action_just_pressed("down") and not falling: + + if Input.is_action_just_pressed("down") and not falling and not isWallSliding(): falling = true velocity.y = clamp(velocity.y + FALL_SPEED, FALL_SPEED, INF) - if is_on_wall_only(): - velocity.y = lerpf(velocity.y, clamp(velocity.y, JUMP_VELOCITY, 100), delta * 10) + if isWallSliding(): + var upDown = clamp(Input.get_axis("up", "down"), -0.5, 1) + var holdMulti = (upDown * 2) + 1 + velocity.y = lerpf(velocity.y, clamp(velocity.y, JUMP_VELOCITY, 100 * holdMulti), delta * 10) - var finalSpeed = clamp(abs(velocity.x), SPEED, SPEED * 2) - abs(addedveloc) - - finalSpeed = clamp(lerp(finalSpeed, SPEED, delta * 10), SPEED, INF) - #print(finalSpeed) + var finalSpeed = clamp(abs(velocity.x), SPEED, INF) + if floorTime > 0.05: + finalSpeed = clamp(lerp(finalSpeed, SPEED, delta * 20), SPEED, INF) velocity.x = lerp(velocity.x, direction * finalSpeed, delta * ACCEL) - #if abs(velocity.x) < abs(addedveloc): - #print("boiyoing") - velocity.x += addedveloc * delta * 10 - + if abs(velocity.x) < abs(addedveloc): + addedveloc = lerp(addedveloc, velocity.x, ACCEL * 2 * delta) + velocity.x += addedveloc * delta * 15 + addedveloc = lerpf(addedveloc, 0, delta * 5) move_and_slide() diff --git a/Player/Camera/CameraController.gd b/Player/Camera/CameraController.gd new file mode 100644 index 0000000..475d410 --- /dev/null +++ b/Player/Camera/CameraController.gd @@ -0,0 +1,10 @@ +extends Camera2D + +@onready var player = $"../" + +func _process(delta): + var velocModifier = clamp(abs(player.velocity.x) - 700, 0, 1000) + var direction = clamp(player.velocity.x, -1, 1) + + position = (get_local_mouse_position() / 3) + position.x += velocModifier * direction / 10 diff --git a/Player/Camera/camera.tscn b/Player/Camera/camera.tscn new file mode 100644 index 0000000..a95f8d6 --- /dev/null +++ b/Player/Camera/camera.tscn @@ -0,0 +1,9 @@ +[gd_scene load_steps=2 format=3 uid="uid://cjjrxtvufk35a"] + +[ext_resource type="Script" path="res://Player/Camera/CameraController.gd" id="1_5yyqm"] + +[node name="Camera" type="Camera2D"] +zoom = Vector2(3, 3) +position_smoothing_enabled = true +position_smoothing_speed = 35.0 +script = ExtResource("1_5yyqm") diff --git a/Player/GUI/GUI.tscn b/Player/GUI/GUI.tscn new file mode 100644 index 0000000..af83100 --- /dev/null +++ b/Player/GUI/GUI.tscn @@ -0,0 +1,50 @@ +[gd_scene load_steps=3 format=3 uid="uid://b6rvghqqnqqk1"] + +[ext_resource type="Script" path="res://Player/GUI/GuiRoot.gd" id="1_hovww"] + +[sub_resource type="LabelSettings" id="LabelSettings_nvd2b"] +font_size = 32 + +[node name="CanvasLayer" type="CanvasLayer"] + +[node name="GuiRoot" type="Control" parent="."] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +script = ExtResource("1_hovww") + +[node name="Velocity" type="Label" parent="GuiRoot"] +layout_mode = 0 +offset_right = 79.0 +offset_bottom = 23.0 +text = "Velocity: 0" +label_settings = SubResource("LabelSettings_nvd2b") + +[node name="HorzVeloc" type="Label" parent="GuiRoot"] +layout_mode = 0 +offset_top = 44.0 +offset_right = 328.0 +offset_bottom = 89.0 +text = "Horizontal Velocity: 0" +label_settings = SubResource("LabelSettings_nvd2b") + +[node name="VertVeloc" type="Label" parent="GuiRoot"] +layout_mode = 0 +offset_top = 88.0 +offset_right = 283.0 +offset_bottom = 133.0 +text = "Vertical Velocity: 0" +label_settings = SubResource("LabelSettings_nvd2b") + +[node name="AddedVeloc" type="Label" parent="GuiRoot"] +layout_mode = 0 +offset_top = 132.0 +offset_right = 283.0 +offset_bottom = 177.0 +text = "Added Velocity: 0" +label_settings = SubResource("LabelSettings_nvd2b") diff --git a/Player/GUI/GuiController.gd b/Player/GUI/GuiController.gd new file mode 100644 index 0000000..c384610 --- /dev/null +++ b/Player/GUI/GuiController.gd @@ -0,0 +1,5 @@ +extends Control +# +#func _process(delta): + #position = -get_viewport_transform().get_origin() + #print(position) diff --git a/Player/GUI/GuiRoot.gd b/Player/GUI/GuiRoot.gd new file mode 100644 index 0000000..9e9aee2 --- /dev/null +++ b/Player/GUI/GuiRoot.gd @@ -0,0 +1,13 @@ +extends Control + +@onready var player = $"../../" + +@onready var velocNumb = $"Velocity" +@onready var horzVeloc = $"HorzVeloc" +@onready var vertVeloc = $"VertVeloc" +@onready var addedVeloc = $"AddedVeloc" +func _physics_process(delta): + velocNumb.text = "Velocity: " + str(round(player.velocity.length())) + horzVeloc.text = "Horizontal Velocity: " + str(round(abs(player.velocity.x))) + vertVeloc.text = "Vertical Velocity: " + str(round(abs(player.velocity.y))) + addedVeloc.text = "Added Velocity: " + str(round(abs(player.addedveloc))) diff --git a/Player/GrappleHook/GrappleCenter.png b/Player/GrappleHook/GrappleCenter.png new file mode 100644 index 0000000..b7dd542 Binary files /dev/null and b/Player/GrappleHook/GrappleCenter.png differ diff --git a/Player/GrappleHook/GrappleCenter.png.import b/Player/GrappleHook/GrappleCenter.png.import new file mode 100644 index 0000000..e649808 --- /dev/null +++ b/Player/GrappleHook/GrappleCenter.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bi5ofgcvid5qk" +path="res://.godot/imported/GrappleCenter.png-5e9ed5c2d1472f72fd1015c922d13ef9.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Player/GrappleHook/GrappleCenter.png" +dest_files=["res://.godot/imported/GrappleCenter.png-5e9ed5c2d1472f72fd1015c922d13ef9.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Player/GrappleHook/GrappleHook.gd b/Player/GrappleHook/GrappleHook.gd new file mode 100644 index 0000000..c749ba6 --- /dev/null +++ b/Player/GrappleHook/GrappleHook.gd @@ -0,0 +1,93 @@ +extends Node2D + +@onready var player = $"../../" +@onready var sprite = $"../" + +@onready var grappleCore = $"../GrappleCore" + +@onready var Smoother = $"../../../Smoother" + +var grappleProjectile = preload("res://Player/GrappleHook/GrappleHookProjectile/GrappleHookProjectile.tscn") + +var proj = null + +var grappleSpeed = Vector2.ZERO +var retractDur = 0 +var retractStart = Vector2.ZERO + +var grappleDur = 0 + +var grappling = false +var retracting = false + +func launch(delta): + if proj: + player.jumps = player.MAX_JUMPS - 1 + var grappleVeloc = (proj.position - player.position).normalized() * grappleSpeed + player.launch(grappleVeloc.x) + player.velocity.y = grappleVeloc.y + +func grappleStart(): + grappleSpeed = (500 + clamp(player.velocity.length(), 500, 1000)) + grappleDur = .5 + grappling = true + +func _physics_process(delta): + grappleDur -= delta + + var moveVector = (get_global_mouse_position() - player.position).normalized() + + if Input.is_action_just_pressed("pullGrapple") and not proj: + #player.velocity.y = player.JUMP_VELOCITY / 2 + + proj = grappleProjectile.instantiate() + + proj.position = player.position + proj.rotation = moveVector.angle() + + proj.velocity = (moveVector * 1500) + player.velocity + #grappleDur = 10 + add_child(proj) + #else: + + if proj and grappleDur > 0 and (player.position - proj.position).length() > 15 and not Input.is_action_just_pressed("jump"): + launch(delta) + elif proj and grappling: + player.jumps = 1 + player.velocity.y = player.JUMP_VELOCITY + grappleDur = 0 + + retractStart = proj.position + retracting = true + grappling = false + +func _process(delta): + if proj and retracting == true: + proj.position = lerp(retractStart, player.position, retractDur) + retractDur += delta * 4 + if retractDur >= 1: + proj.queue_free() + proj = null + retracting = false + retractDur = 0 + + if proj: + #Engine.time_scale = 0.1 + var grappleLine = proj.get_node("GrappleLine") + var grappleBord = proj.get_node("GrappleBord") + + var grapOffset = grappleCore.offset * sprite.scale + + grappleLine.set_point_position(1, player.position + grapOffset) + grappleBord.set_point_position(1, player.position + grapOffset) + + grappleLine.set_point_position(0, proj.position) + grappleBord.set_point_position(0, proj.position) + + var curve = Curve.new() + curve.add_point(Vector2(0, 1)) + curve.add_point(Vector2(1, sprite.scale.y)) + + grappleLine.width_curve = curve + grappleBord.width_curve = curve + diff --git a/Player/GrappleHook/GrappleHookProjectile/Grapple.png b/Player/GrappleHook/GrappleHookProjectile/Grapple.png new file mode 100644 index 0000000..2ccd800 Binary files /dev/null and b/Player/GrappleHook/GrappleHookProjectile/Grapple.png differ diff --git a/Player/GrappleHook/GrappleHookProjectile/Grapple.png.import b/Player/GrappleHook/GrappleHookProjectile/Grapple.png.import new file mode 100644 index 0000000..9f6ee02 --- /dev/null +++ b/Player/GrappleHook/GrappleHookProjectile/Grapple.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bncu47o5ynskj" +path="res://.godot/imported/Grapple.png-feaba7449a5f3ea3aa251c5a08ccef36.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Player/GrappleHook/GrappleHookProjectile/Grapple.png" +dest_files=["res://.godot/imported/Grapple.png-feaba7449a5f3ea3aa251c5a08ccef36.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Player/GrappleHook/GrappleHookProjectile/GrappleHookProjectile.gd b/Player/GrappleHook/GrappleHookProjectile/GrappleHookProjectile.gd new file mode 100644 index 0000000..8052173 --- /dev/null +++ b/Player/GrappleHook/GrappleHookProjectile/GrappleHookProjectile.gd @@ -0,0 +1,37 @@ +extends CharacterBody2D + +var lifeTime = 0.6 + +@onready var parent = get_parent() + +var lastPos = null + +var detecting = true + +func objectHit(body): + if body != self: + velocity = Vector2.ZERO + parent.grappleStart() + +func _physics_process(delta): + if not lastPos: + lastPos = position + + move_and_slide() + + if detecting: + if lifeTime <= 0: + velocity = Vector2.ZERO + parent.retracting = true + parent.retractStart = position + lifeTime -= delta + var space_state = get_world_2d().direct_space_state + + var query = PhysicsRayQueryParameters2D.create(lastPos, position, 3, [parent.get_parent().get_parent()]) + var result = space_state.intersect_ray(query) + + if result: + detecting = false + position = result.position + objectHit(result.collider) + print(result.position) diff --git a/Player/GrappleHook/GrappleHookProjectile/GrappleHookProjectile.tscn b/Player/GrappleHook/GrappleHookProjectile/GrappleHookProjectile.tscn new file mode 100644 index 0000000..c39e1a5 --- /dev/null +++ b/Player/GrappleHook/GrappleHookProjectile/GrappleHookProjectile.tscn @@ -0,0 +1,43 @@ +[gd_scene load_steps=4 format=3 uid="uid://dmgf8fsvy1wjh"] + +[ext_resource type="Script" path="res://Player/GrappleHook/GrappleHookProjectile/GrappleHookProjectile.gd" id="1_nba88"] +[ext_resource type="Texture2D" uid="uid://bncu47o5ynskj" path="res://Player/GrappleHook/GrappleHookProjectile/Grapple.png" id="2_sst4t"] +[ext_resource type="Texture2D" uid="uid://gn347ng3iu02" path="res://Player/GrappleHook/GrappleHookProjectile/GrappleTether.png" id="2_xkdsl"] + +[node name="GrappleHook" type="CharacterBody2D"] +top_level = true +disable_mode = 2 +collision_layer = 4 +collision_mask = 0 +motion_mode = 1 +platform_floor_layers = 4294967040 +script = ExtResource("1_nba88") + +[node name="Sprite" type="Sprite2D" parent="."] +z_index = 2 +texture = ExtResource("2_sst4t") + +[node name="GrappleLine" type="Line2D" parent="."] +top_level = true +z_index = 1 +texture_repeat = 2 +points = PackedVector2Array(0, 0, 33, 0) +width = 4.0 +texture = ExtResource("2_xkdsl") +texture_mode = 1 +joint_mode = 2 +begin_cap_mode = 2 +end_cap_mode = 2 +round_precision = 4 + +[node name="GrappleBord" type="Line2D" parent="."] +modulate = Color(0, 0, 0, 1) +top_level = true +texture_repeat = 2 +points = PackedVector2Array(0, 0, 33, 0) +width = 6.0 +texture_mode = 1 +joint_mode = 2 +begin_cap_mode = 2 +end_cap_mode = 2 +round_precision = 4 diff --git a/Player/GrappleHook/GrappleHookProjectile/GrappleTether.kra b/Player/GrappleHook/GrappleHookProjectile/GrappleTether.kra new file mode 100644 index 0000000..fe8b2c5 Binary files /dev/null and b/Player/GrappleHook/GrappleHookProjectile/GrappleTether.kra differ diff --git a/Player/GrappleHook/GrappleHookProjectile/GrappleTether.png b/Player/GrappleHook/GrappleHookProjectile/GrappleTether.png new file mode 100644 index 0000000..9761fc4 Binary files /dev/null and b/Player/GrappleHook/GrappleHookProjectile/GrappleTether.png differ diff --git a/Player/GrappleHook/GrappleHookProjectile/GrappleTether.png.import b/Player/GrappleHook/GrappleHookProjectile/GrappleTether.png.import new file mode 100644 index 0000000..c61ada6 --- /dev/null +++ b/Player/GrappleHook/GrappleHookProjectile/GrappleTether.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://gn347ng3iu02" +path="res://.godot/imported/GrappleTether.png-070f72f0eebbe08ec00dac245679c61b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Player/GrappleHook/GrappleHookProjectile/GrappleTether.png" +dest_files=["res://.godot/imported/GrappleTether.png-070f72f0eebbe08ec00dac245679c61b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Player/GrappleHook/GrappleHookProjectile/GrappleTether.png~ b/Player/GrappleHook/GrappleHookProjectile/GrappleTether.png~ new file mode 100644 index 0000000..c74dea3 Binary files /dev/null and b/Player/GrappleHook/GrappleHookProjectile/GrappleTether.png~ differ diff --git a/Player/GrappleHook/PullGrapple.kra b/Player/GrappleHook/PullGrapple.kra new file mode 100644 index 0000000..e8f210d Binary files /dev/null and b/Player/GrappleHook/PullGrapple.kra differ diff --git a/Player/GrappleHook/PullGrapple.png~ b/Player/GrappleHook/PullGrapple.png~ new file mode 100644 index 0000000..8ea81db Binary files /dev/null and b/Player/GrappleHook/PullGrapple.png~ differ diff --git a/project.godot b/project.godot index e4ed4c5..f2ff6f4 100644 --- a/project.godot +++ b/project.godot @@ -21,6 +21,11 @@ config/icon="res://icon.svg" gen="*res://Core/Scripts/GeneralFunctions.gd" +[display] + +window/size/viewport_width=1920 +window/size/viewport_height=1080 + [editor] version_control/plugin_name="GitPlugin" @@ -71,10 +76,16 @@ spinGrapple={ , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":81,"key_label":0,"unicode":113,"echo":false,"script":null) ] } +respawn={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":82,"key_label":0,"unicode":114,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194308,"key_label":0,"unicode":0,"echo":false,"script":null) +] +} [physics] -common/physics_ticks_per_second=144 +common/physics_jitter_fix=0.0 2d/default_gravity=1300.0 [rendering]